Failed to resolve: com.facebook.android:facebook-android-sdk:[4,5)

41,153

Solution 1

Follow the below procedure to resolve the issue:-

  1. Click on Project Structure from the icon available in the tool bar above.

  2. Open Dependencies tab.

  3. select

    com.facebook.android:facebook-android-sdk:[4,5)

  4. Remove the facebook dependency by clicking the minus(-) button on the extreme right side.

  5. Now, Click on Plus(+) button on the right side above Minus button. Select Library dependency

  6. Type Facebook on the search input box and click on the search button.

  7. Choose com.facebook.android:facebook-login. click on Ok. Sync your Gradle.

This will resolve your issue. As it has worked for me.

Solution 2

Use this dependency for Facebook SDK. It will work. (Tested on Android Studio version 3.0 and above)

implementation 'com.facebook.android:facebook-login:4.30.0'

Solution 3

remove compile 'com.facebook.android:facebook-android-sdk:[4,5)'

And add below dependency it resolve my problem

compile 'com.facebook.android:facebook-android-sdk:4.26.0'

Solution 4

In the file android/build.gradle try to replace each jcenter() with gradlePluginPortal()

Solution 5

If your react-native version is >= 9.3.0+ you can solve this issue by just removing and adding some lines:

 1)Remove this line from app/build.gradle ===>
 implementation 'com.facebook.android:facebook-android-sdk:[5,6)'

 2)Add this line in app/build.gradle ===>
  implementation 'com.facebook.android:facebook-android- 
  sdk:latest.release'

 3)Add this in android/build.gradlew 
 allprojects {
repositories {


    google()
    mavenLocal()
    maven {
        // Android JSC is installed from npm
        url("$rootDir/../node_modules/jsc-android/dist")
    }
   mavenCentral().  <====== Add this
    google()
    jcenter()
    maven { url 'https://www.jitpack.io' }
  }
}

4)At the end run gradlew clean command

Share:
41,153

Related videos on Youtube

Vinayak B
Author by

Vinayak B

A forward-thinking developer offering more than six years of experience building, integrating, testing, and supporting Android applications for mobile and tablet devices on the Android platform.

Updated on July 09, 2022

Comments

  • Vinayak B
    Vinayak B almost 2 years

    I am using facebook sdk in my project. Facebook SDK works fine till yesterday. but today when I open my project , the build failed and shows error as follows

     Error:A problem occurred configuring project ':app'.
    > Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
       > Could not resolve com.facebook.android:facebook-android-sdk:[4,5).
         Required by:
             project :app
          > Could not resolve com.facebook.android:facebook-android-sdk:[4,5).
             > Failed to list versions for com.facebook.android:facebook-android-sdk.
                > Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml.
                   > Could not GET 'https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml'.
                      > jcenter.bintray.com
          > Could not resolve com.facebook.android:facebook-android-sdk:[4,5).
             > Failed to list versions for com.facebook.android:facebook-android-sdk.
                > Unable to load Maven meta-data from https://jitpack.io/com/facebook/android/facebook-android-sdk/maven-metadata.xml.
                   > Could not GET 'https://jitpack.io/com/facebook/android/facebook-android-sdk/maven-metadata.xml'.
                      > jitpack.io
    

    I tries clean & build and also inavalidate caches .but nothing worked. Also tries some stackoverflow solutions. none of them worked for me

    this my repository in build.gradle

     repositories {
        jcenter()
        mavenCentral()
    }
    allprojects {
        repositories {
            jcenter()
            maven { url "https://jitpack.io" }
        }
    }
    
    • Kartik Shandilya
      Kartik Shandilya over 6 years
      Try removing the dependencies and re-adding them and then Clean Build the project again. Also, make sure your Studio and all Services are updated.
    • Vinayak B
      Vinayak B over 6 years
      I think It's repository error. Right now its working . I re-added everything one by one. Thanks for your replay
  • Rezaul Karim
    Rezaul Karim over 4 years
    i came here for answering this question. after seeing your answer i turn back as the finest answer exists..