Failed to resolve: com.facebook.android:facebook-android-sdk:[4,5)
Solution 1
Follow the below procedure to resolve the issue:-
Click on
Project Structure
from the icon available in thetool bar
above.Open
Dependencies
tab.select
com.facebook.android:facebook-android-sdk:[4,5)
Remove the facebook dependency by clicking the minus(
-
) button on the extreme right side.Now, Click on Plus(
+
) button on the right side above Minus button. SelectLibrary dependency
Type
Facebook
on the search input box and click on the search button.Choose
com.facebook.android:facebook-login
. click onOk
. 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
Related videos on Youtube
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, 2022Comments
-
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 over 6 yearsTry 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 over 6 yearsI think It's repository error. Right now its working . I re-added everything one by one. Thanks for your replay
-
-
Rezaul Karim over 4 yearsi came here for answering this question. after seeing your answer i turn back as the finest answer exists..