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... :-)
Related
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 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
Adding a gradle project with compile has been working for me very well, but I noticed after updating the Android studio to 1.2.2, or maybe the version just before it, that adding a library is not working anymore.
So for example I tried to add this and I did the "Sync Now" and it was successful but the library doesn't seem to be recognized. When I try to use ProgressWheel in Java and I hit ctrl+Enter it doesn't find the library, anyone have an idea of what should I do?
dependencies {
compile 'com.android.support:support-v4:21.0.0'
compile 'com.google.android.gms:play-services:+'
compile files('libs/universal-image-loader-1.9.3.jar')
compile 'com.romainpiel.shimmer:library:1.4.0#aar'
//the above libraries were added before the update, everything was
//working fine, the below isn't
compile 'com.pnikosis:materialish-progress:1.5'
}
Please note that I tried many other libraries and all had the same result.
The project README (front page of https://github.com/pnikosis/materialish-progress) says it's on Maven Central. Android Studio uses jCenter (by Bintray) by default. Add this in your module's build.gradle file:
repositories {
mavenCentral()
}
I need to integrate MoPub inside an android library shared by 3 different games.
I tried to use the fabric plugin with no success... after some attempts I get this error:
Error:Failed to resolve: com.mopub.volley:mopub-volley:1.1.0
Then I also tried to follow this guide that you can find here (https://github.com/mopub/mopub-android-sdk/wiki/Getting-Started) but I always get some errors (I can't execute the gradle command via terminal or I get the same error as mentioned above).
Can someone help me?
Thank you,
Mirko
UPDATE
Thanks to #Edward I was able to import correctly mopub-sdk in my project.
In order to fix the mopub-volley error, first clean the solution, read which files are missing in the console, look at the path, recreate the indicated path and add mopub-volley-1.1.0.jar, mopub-volley-1.1.0.pom in that folder.
Rebuild and you are ready to go!
In my case, mopub-sdk was looking for the mopub-volley lib inside an
inexistent folder in the same path of the android sdk.
If you get another error related to the millenial sdk, add this line in the dependencies section of the build.gradle file inside the mopub-sdk library:
compile fileTree(dir: 'libs', include: ['*.jar'])
you should get something like this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:support-annotations:22.0.0'
compile 'com.mopub.volley:mopub-volley:1.1.0'
}
Hope this can help you!
Go download the MoPub SDK.
Unzip and you will get a mopub-sdk folder
Navigate to your ‘Project location’, go into your project folder, and drop the unzipped mopub-sdk into the folder.
Navigate back to Android Studio and open your project's settings.gradle file and include the MoPub SDK as a module as shown below. You may need to sync Gradle again in Android Studio to have the ‘mopub-sdk’ show up in the left Project window.
include ':app', ':mopub-sdk'
Open your project's build.gradle file and add jcenter as a repository and the MoPub SDK as a dependency:
repositories {
jcenter()
}
...
dependencies {
compile project(':mopub-sdk')
...
}
For those late to the party:
repositories {
jcenter()
}
dependencies {
compile('com.mopub:mopub-sdk:4.8.0#aar') {
transitive = true
}
}
just make sure you've added jcenter() in the your repositories. fabric does not do this automatically for some reason
It looks like there is no mopub-volley lib into mavencentral or jcenter
So tou can try to use
compile 'com.mcxiaoke.volley:library:1.0.18'
instead of
compile 'com.mopub.volley:mopub-volley:1.1.0'
It helps for me.
I've taken an Android project that was created in IntelliJ and imported it into AndroidStudio. After looking at Googles hopeless instructions for how to migrate a project to Gradle I pressed buttons at random and prayed to the gods of droid whilst sacrificing a small innocent child and somehow eventually ended up with a Gradle controlled project that synced, built and ran on my Android devices.
I then added some additional dependencies to my build.gradle file:
compile 'com.octo.android.robospice:robospice:1.4.12'
compile 'com.octo.android.robospice:robospice-spring-android:1.4.12'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.http-client:google-http-client-jackson:1.18.0-rc'
compile 'com.octo.android.robospice:robospice-google-http-client:1.4.12'
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
Now when I try to sync Gradle I get the following message:
Gradle Project sync Failed. Basic functionality (e.g. editing, debugging) will not work properly.
In the Gradle Sync window I get the following messages:
Unresolved Dependencies:
Error:com.google.http-client:google-http-client-gson:1.18.0-rc
Error:com.octo.android.robospice:robospice-spring-android:1.4.12
...
and so on for each of the dependencies that I have listed.
How might I resolve this?
OK I've figured it out.
I added
allprojects {
repositories {
mavenCentral()
}
}
to the bottom of my build.gradle file.
It was obviously struggling to find a repository to load from.
The script already had
buildscript {
repositories {
mavenCentral()
}
This it would seem was insufficient.