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" }
}
}
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.
If you are using android studio below 3.0 version then Try this: Replace the dependency
compile 'com.facebook.android:facebook-android-sdk:4.26.0'
Remove the dependencies and then just re-add the dependencies one by one. Finally Clean Build the Project and it should work.
A Studio or a library update may sometimes cause this type of issue.
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'
Try the below dependency. It worked for me
Try below, works perfect for me