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 the tool 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. Select Library dependency
Type Facebook on the search input box and click on the search button.
Choose com.facebook.android:facebook-login. click on Ok.
Sync your Gradle.
This will resolve your issue. As it has worked for me.
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'
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'
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
In the file android/build.gradle try to replace each jcenter() with gradlePluginPortal()
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'
Try below, works perfect for me
implementation 'com.facebook.android:facebook-android-sdk:[4,5]'
try to add
implementation 'com.facebook.android:facebook-core:[8,9)'
implementation 'com.facebook.android:facebook-login:[8,9)'
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.
Add this to Module-level /app/build.gradle before dependencies:
repositories {
// You can also use jcenter if you prefer
mavenCentral()
}
Add the compile dependency you need with the latest version of the Facebook SDK in the build.gradle file:
dependencies {
// Facebook SDK Core only (Analytics)
compile 'com.facebook.android:facebook-core:[5,6)'
// Facebook Login only
compile 'com.facebook.android:facebook-login:[5,6)'
// Facebook Share only
compile 'com.facebook.android:facebook-share:[5,6)'
// Facebook Places only
compile 'com.facebook.android:facebook-places:[5,6)'
// Facbeook Messenger only
compile 'com.facebook.android:facebook-messenger:[5,6)'
// Facebook App Links only
compile 'com.facebook.android:facebook-applinks:[5,6)'
// Facebook Android SDK (everything)
compile 'com.facebook.android:facebook-android-sdk:[5,6)'
// Audience Network SDK.
compile 'com.facebook.android:audience-network-sdk:[5,6)'
// Account Kit
compile 'com.facebook.android:account-kit-sdk:[5,6)'
}
Worked for me:
implementation 'com.facebook.android:audience-network-sdk:5.5.0'
Release implementation 'com.facebook.android:facebook-login:[5,6)' with implementation 'com.facebook.android:facebook-login:5.15.1'
Try the below dependency. It worked for me
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
Earlier I had different versions of facebook-android-sdk:[5,6) & facebook-applinks:[4,5). I made it the same version and it seems to build (facebook-applinks:[5,6)).
Just go to file -> re-import gradle project if you use Intelij or Android studio. I think it's a pretty simple solution. it worked for me.
1- Make a search in google like this : facebook audience network sdk download
2- Go to the first result : https://developers.facebook.com/docs/audience-network/guides/adding-sdk/android
3- See the section of Manual download
4- You will find the latest version number (for example here : 6.0.0 or 5.11.0)
5- Add the dependency like this in your build.gradle(:app) :
implementation 'com.facebook.android:audience-network-sdk:6.2.1'
Had same issue, fixed it by changing
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
to
implementation 'com.facebook.android:facebook-android-sdk:4.30.0'
in app/build.gradle
I create empty project in android studio 2.3.3 and it by default has compile 'com.android.support:appcompat-v7:26.+' in it's module level build.gradle file and it compiles ok, but when I specify any concrete version from https://developer.android.com/topic/libraries/support-library/revisions.html#26-0-2
gradle sync fails with message
I also tried the following notation compile group: 'com.android.support', name:'v7-appcompat', version: '26.0.0', still no success.
I have
jcenter()
maven {
url "https://maven.google.com"
}
in repositories secion. Install repository and sync project button is not clickable. Support repository is updated:
You misswrote the artefact name. Change it as below:
compile 'com.android.support:v7-appcompat:26.0.0'
to
compile 'com.android.support:appcompat-v7:26.0.0'
Be sure to use:
compileSdkVersion 26
buildToolsVersion "26.0.0"
or later.
Invalidate Cache, go to File > Invalidates Caches
Just click in the Install Repository and sync Project link to install the missing dependencies.
Then sync your project with the gradle files again.
Second solution, try uninstalling an reinstalling Android Support Repository again (I think its similar to clean cache):
Check the error message:
Failed to resolve com.android.support:v7-appcompat:26.0.0'
The right library is appcompat-v7 and not v7-appcompat
Use:
compile 'com.android.support:appcompat-v7:26.x.x'
I'm trying to setup OneSignal push notifocation in my Android app. I have changed my build.gradle to include the required dependencies (or so I think).
No matter what I do I keep getting
Failed to resolve: com.onesignal:OneSignal:3.4.3
or
Could not find com.onesignal:OneSignal:3.4.3
Can anyone give me a slight push please? Thanks in advance :-)
I should mention that I have checked the trouble shooting section on OneSignals home page. All is in order.
Here's the dependencies section of my gradle file:
dependencies {
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'com.google.firebase:firebase-analytics:9.6.0'
compile 'com.google.firebase:firebase-crash:9.6.0'
compile files('src/main/libs/simple-xml-2.7.jar')
compile files('src/main/libs/date4j.jar')
compile files('src/main/libs/picasso-2.5.2.jar')
compile 'com.onesignal:OneSignal:3.4.3#aar'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
}
The OneSignal SDK is hosted on Maven Central so I would first make sure you can access this from your system. Next double check the following as well.
Make sure you're using Android Studio version 1.4.0 or newer.
Go to File>Settings. Search for Offline work and uncheck that option.
Add the following to your .gradle file.
Root build.gradle
repositories {
mavenCentral()
}
4. Try restarting Android Studio and then going to Tool>Android>Sync Project again.
5.Try building OneSignal's example Android Studio project. If this works then the problems is related to your project.
Screenshots for some of these steps below.
https://documentation.onesignal.com/docs/troubleshooting-android
Well... what finally fixed this issue for me was to replace
mavenCentral()
with
jcenter()
go figure... :-)
In my project, I'm trying to use the design support library. I have in my Gradle file:
dependencies {
....
compile 'com.android.support:design'
....
}
And when I try to build this, I get the error:
Normally I would just click Install Repository and sync project, however, this seems to not work anymore. Clicking this does absolutely nothing, even though clicking Open File works fine.
How can I manually install it?
I have the latest Android Support Repository (30.0.0), and Android Support Library (23.2.1) installed.
For me the solution was to add maven in the allprojects section. From the setup document: https://developer.android.com/topic/libraries/support-library/setup.html
in the project level settings.gradle file.
allprojects {
repositories {
jcenter()
maven{
url "https://maven.google.com"
}
}
}
Then double check the document for the latest version.
In the app level of the settings.gradle file add:
dependencies{
compile 'com.android.support:design:26.0.1'
}
And use Gradle to sync the project.
I think it is because you've not specified the version.
compile 'com.android.support:design:23.1.1'
change version to what you have downloaded.
You can go File->Settings->Gradle Look at the "Offline work" inbox,
If it's checked you can uncheck and try to sync again.
I try to repair the dependency to google play services in my android project. It already worked but now it is broken. I think this happened in between the Android Studio beta- and release-version.
This is the dependency in the build.gradle file:
dependencies {
compile 'com.google.android.gms:play-services:6.5.87'
}
Android Studio was able to autocomplete the version string: '6.5.87' So I thought it knows how to solve the dependency. But it does not.. This is what I treid:
reinstaled Android Studio (1.0.1) and the Android SDK
used several play-service versions (incl. tried to use '+')
tried to 'gradlew clean' the project
installed almost everything from the Android SDK Manager. (incl. Google Repository and Android Support Repository)
set all environment variables to the correct path
But I still get this error if I try to do a gradle project sync:
Error:Could not find com.google.android.gms:play-services:6.5.87.
Searched in the following locations:
file:/C:/Users/MyName/.m2/repository/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pom
file:/C:/Users/MaName/.m2/repository/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jar
https://repo1.maven.org/maven2/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pom
https://repo1.maven.org/maven2/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jar
https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pom
https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jar
https://oss.sonatype.org/content/repositories/releases/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.pom
https://oss.sonatype.org/content/repositories/releases/com/google/android/gms/play-services/6.5.87/play-services-6.5.87.jar
Required by:
code:android:1.0
UPDATE:
Gradle is searching in "file:/C:/Users/MyName/.m2/repository/" but it should use
"file:/C:/Users/MyName/AppData\Local\Android\sdk\extras\google\m2repository" .. I dont know why this is wrong and how to fix it..
UPDATE 2
I fixed it using this workaround:
repositories {
def androidHome = System.getenv("ANDROID_HOME")
maven { url "$androidHome/extras/android/m2repository/" }
maven { url "$androidHome/extras/google/m2repository/"}
}
But I am not happy with it. Does anybody know whats wrong with my gradle?
In Android SDK Manager download the "Google Repository"
Try download the sdk and use this library
compile 'com.google.android.gms:play-services:7.0.0'
After adding jcenter() to reposetories or top level gradle file I fixed the issue
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'
classpath 'com.google.gms:google-services:1.5.0-beta2'
}
}