Open CeccoCQ opened 5 years ago
@CeccoCQ Could you let us know when you did to speed up the build? You noted that "... but when I try to speed up the gradle build, I get this error".
I recommend making sure Android Studio isn't set to offline mode. https://documentation.onesignal.com/docs/troubleshooting-android#section-failed-to-resolve-com-onesignal-onesignal-3-10-2-3-99-99-
Also make sure you are not having any connection issues, or have a firewall or proxy blocking any connections.
Hi @jkasten2 thanks for your reply. For my projects, usually I works in offline mode (travel, meeting, etc..) and It would be important for me to have the possibility to do it in offline mode also because sometimes my internet connection is very slow. Is there a way to by-pass this limit?
I think to something like import specific dependency or exclude modules from onesignal library.
@CeccoCQ Sorry for the delay, you should be able to sync your gradle once when online and then be able to do builds offline without any issues. You should also be able to change your build.gradle
files and resync without any issues, however only if you don't add or change any versions your system hasn't cached yet.
If you found any cases where offline does not work even though you synced once while online let us know the exact steps to reproduce the issue and we can take a 2nd look. Thanks!
@jkasten2 thanks for your response, but currently I'm not able to sync my project in offline mode.
Please, follow these steps:
Add on root build.gradle:
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.1'
Add on app build.gradle:
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
implementation ('com.onesignal:OneSignal:3.10.5')
Set android studio in online mode, sync gradle and run the project
Set android studio in offline mode, sync gradle and run the project
Now, you have these errors:
Could not resolve com.google.android.gms:play-services-base:[15.0.0, 16.0.0).
Required by:
project :app > com.onesignal:OneSignal:3.10.5
> No cached version listing for com.google.android.gms:play-services-base:[15.0.0, 16.0.0) available for offline mode.
Could not resolve com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
Required by:
project :app > com.google.android.gms:play-services-location:15.0.1
project :app > com.google.android.gms:play-services-places-placereport:15.0.1
> No cached version listing for com.google.android.gms:play-services-basement:[15.0.1,16.0.0) available for offline mode.
Could not resolve com.google.android.gms:play-services-tasks:[15.0.1,16.0.0).
Required by:
project :app > com.google.android.gms:play-services-location:15.0.1
> No cached version listing for com.google.android.gms:play-services-tasks:[15.0.1,16.0.0) available for offline mode.
@CeccoCQ We were not able to reproduce the issue with the steps you provided on our example project. https://github.com/OneSignal/OneSignal-Android-SDK/tree/master/Examples/AndroidStudio
Can you try this project as well to let us know if you can reproduce it?
If not then the issue is related to your specific project. Please share your all your build.gradle
files here and we can try reproducing the issue with them.
I've found the issue. The problem is related to the different version of play services and firebase.
The solution is to add the exclude clause to dependency:
implementation ('com.onesignal:OneSignal:3.10.5') {
exclude group: 'com.google.android.gms'
}
then add the missing dependencies manually, for example:
implementation "com.google.android.gms:play-services-location:${gms.location}"
This is caused by the dependency of Google Play Services into OneSignal SDK that are not aligned with the latest versions of firebase and gms.
@CeccoCQ Thanks for replying back with a workaround for the issue. The issue might be related to the OneSignal-Gradle-Plugin and how it scans the project then picks versions of dependencies based on what it finds. When it doing it's version discovery process it might not trigger gradle to cache the intermittent versions. So when it tries to do this process offline it might be missing some versions from the cache.
We can still look into fixing this issue but haven't been able to reproduce it yet. We will be testing with a flushed Gradle cache with some projects but if you have specific build.gradle
you can share this will be helpful.
Closing due to inactivity
Hello! I faced with the same issue described in previous post. Also I use version 3.9.1 and workaround doesn't work for me. Do you have any updates?
@Mu3AHTPOn Can you reproduce the issue in a new project and share it? I tried what was in the previous post you noted but we were unable to reproduce the issue before.
Hi, i am getting this error when resync gradle. Please help
using on implementation 'com.onesignal:OneSignal:[3.10.6, 3.99.99]'
ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-location:[15.0.0, 16.0.0). Show Details Affected Modules: app
ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-base:[15.0.0, 16.0.0). Show Details Affected Modules: app
Hi, i am getting this error when resync gradle. Please help
using on implementation 'com.onesignal:OneSignal:[3.10.6, 3.99.99]'
ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-location:[15.0.0, 16.0.0). Show Details Affected Modules: app
ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-base:[15.0.0, 16.0.0). Show Details Affected Modules: app
This issue is actually Intermittent download issues in Bintray. Now everything is working fine.
Checking on the status of Bintray https://status.bintray.com/
After adding One Signal Library, not able to sync offline. Could not resolve com.google.android.gms:play-services-base:[15.0.0, 16.0.0). Required by: project :app > com.onesignal:OneSignal:3.10.7
No cached version listing for com.google.android.gms:play-services-base:[15.0.0, 16.0.0) available for offline mode. No cached version listing for com.google.android.gms:play-services-base:[15.0.0, 16.0.0) available for offline mode. No cached version listing for com.google.android.gms:play-services-base:[15.0.0, 16.0.0) available for offline m
I'm having a similar issue. I'm unable to build my project in offline mode.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
> Could not resolve com.google.firebase:firebase-messaging:[10.2.1, 12.1.0).
Required by:
project :app > com.onesignal:OneSignal:3.10.3
> No cached version listing for com.google.firebase:firebase-messaging:[10.2.1, 12.1.0) available for offline mode.
> No cached version listing for com.google.firebase:firebase-messaging:[10.2.1, 12.1.0) available for offline mode.
> No cached version listing for com.google.firebase:firebase-messaging:[10.2.1, 12.1.0) available for offline mode.
> No cached version listing for com.google.firebase:firebase-messaging:[10.2.1, 12.1.0) available for offline mode.
> No cached version listing for com.google.firebase:firebase-messaging:[10.2.1, 12.1.0) available for offline mode.
> No cached version listing for com.google.firebase:firebase-messaging:[10.2.1, 12.1.0) available for offline mode.
> No cached version listing for com.google.firebase:firebase-messaging:[10.2.1, 12.1.0) available for offline mode.
> Could not resolve com.google.android.gms:play-services-location:[10.2.1, 12.1.0).
Required by:
project :app > com.onesignal:OneSignal:3.10.3
> No cached version listing for com.google.android.gms:play-services-location:[10.2.1, 12.1.0) available for offline mode.
> No cached version listing for com.google.android.gms:play-services-location:[10.2.1, 12.1.0) available for offline mode.
> No cached version listing for com.google.android.gms:play-services-location:[10.2.1, 12.1.0) available for offline mode.
> No cached version listing for com.google.android.gms:play-services-location:[10.2.1, 12.1.0) available for offline mode.
> No cached version listing for com.google.android.gms:play-services-location:[10.2.1, 12.1.0) available for offline mode.
> No cached version listing for com.google.android.gms:play-services-location:[10.2.1, 12.1.0) available for offline mode.
> No cached version listing for com.google.android.gms:play-services-location:[10.2.1, 12.1.0) available for offline mode.
> Could not resolve com.google.android.gms:play-services-base:[10.2.1, 12.1.0).
Required by:
project :app > com.onesignal:OneSignal:3.10.3
> No cached version listing for com.google.android.gms:play-services-base:[10.2.1, 12.1.0) available for offline mode.
> No cached version listing for com.google.android.gms:play-services-base:[10.2.1, 12.1.0) available for offline mode.
> No cached version listing for com.google.android.gms:play-services-base:[10.2.1, 12.1.0) available for offline mode.
> No cached version listing for com.google.android.gms:play-services-base:[10.2.1, 12.1.0) available for offline mode.
> No cached version listing for com.google.android.gms:play-services-base:[10.2.1, 12.1.0) available for offline mode.
> No cached version listing for com.google.android.gms:play-services-base:[10.2.1, 12.1.0) available for offline mode.
> No cached version listing for com.google.android.gms:play-services-base:[10.2.1, 12.1.0) available for offline mode.
Need some help here, this has been a happening to us after updating the OneSignal library. This is quite a blocker for faster builds.
This issue is related to OneSignal-Gradle-Plugin
not supporting offline mode. Depending on what you have in project and what is in your gradle cache on your system when you are offline you may or may not see this problem.
An simple example project reproducing the issue and / or a unit test added to a fork of this repo in MainTest.groovy would help us hunt down and confirm a fix for this issue.
dependencies
in onesignal/build.gradle for a full list of modules OneSignal uses.I have the same issue when wanting to build offline, & this is what I have added in my app's build.gradle as a workaround to overcome it:
// Workaround for the Onesignal plugin issue, when wanting to build in offline-mode:
configurations.all {
resolutionStrategy {
if (project.gradle.startParameter.offline) {
force 'com.google.android.gms:play-services-base:17.1.0'
force 'com.google.android.gms:play-services-basement:17.1.1'
force 'com.google.android.gms:play-services-ads:18.3.0'
force 'com.google.android.gms:play-services-location:17.0.0'
force 'com.google.firebase:firebase-messaging:20.1.2'
force 'com.google.firebase:firebase-analytics:17.2.3'
force 'com.google.firebase:firebase-crashlytics:17.0.0-beta01'
force 'com.google.android.gms:play-services-ads-identifier:17.0.0'
}
}
}
You can keep the libs relevant to your project. The way to identify what all needs to go in that block is: First, add all the play-services & firebase dependencies with the exact versions you have declared in your app. Now try building offline. If all good, it will build successfully. If not, the names of the libraries not available for offline mode will be listed via the plugin. From that error list, add all the mentioned libraries to the code block above with the relevant versions (see note below to help identify version). Repeat until no more errors are seen.
Note: For identifying the version to use, you can generate a dependency chart for your app in online mode & add use it to identify what version is being used. The command to generate a dependency chart is: ./gradlew app:dependencies (Replace 'app' with the module name being used in your project)
Dynamic ranges are such a bad practice. I really don't understand why OneSignal is using them everywhere. You can read the following blog post. It covers most of the arguments for using dynamic versions and why the author disagrees:
https://blog.danlew.net/2015/09/09/dont-use-dynamic-versions-for-your-dependencies/
I have the same issue when wanting to build offline, & this is what I have added in my app's build.gradle as a workaround to overcome it:
// Workaround for the Onesignal plugin issue, when wanting to build in offline-mode: configurations.all { resolutionStrategy { if (project.gradle.startParameter.offline) { force 'com.google.android.gms:play-services-base:17.1.0' force 'com.google.android.gms:play-services-basement:17.1.1' force 'com.google.android.gms:play-services-ads:18.3.0' force 'com.google.android.gms:play-services-location:17.0.0' force 'com.google.firebase:firebase-messaging:20.1.2' force 'com.google.firebase:firebase-analytics:17.2.3' force 'com.google.firebase:firebase-crashlytics:17.0.0-beta01' force 'com.google.android.gms:play-services-ads-identifier:17.0.0' } } }
You can keep the libs relevant to your project. The way to identify what all needs to go in that block is: First, add all the play-services & firebase dependencies with the exact versions you have declared in your app. Now try building offline. If all good, it will build successfully. If not, the names of the libraries not available for offline mode will be listed via the plugin. From that error list, add all the mentioned libraries to the code block above with the relevant versions (see note below to help identify version). Repeat until no more errors are seen.
Note: For identifying the version to use, you can generate a dependency chart for your app in online mode & add use it to identify what version is being used. The command to generate a dependency chart is: ./gradlew app:dependencies (Replace 'app' with the module name being used in your project)
thank you, my problem with offline gradle is fixed with this
without
if (project.gradle.startParameter.offline)
configurations.all {
resolutionStrategy {
force 'com.google.android.gms:play-services-base:17.2.1'
force 'com.google.android.gms:play-services-basement:17.2.1'
force 'com.google.android.gms:play-services-ads:19.1.0'
force 'com.google.android.gms:play-services-location:17.0.0'
force 'com.google.android.gms:play-services-tasks:17.0.1'
force 'com.google.firebase:firebase-messaging:20.1.6'
force 'com.google.firebase:firebase-analytics:17.4.0'
force 'com.google.firebase:firebase-crashlytics:17.0.0'
force 'com.google.android.gms:play-services-ads-identifier:17.0.0'
}
}
and also exclude gms
implementation('com.onesignal:OneSignal:3.13.2') {
exclude group: 'com.google.android.gms'
}
@jkasten2 thanks for your response, but currently I'm not able to sync my project in offline mode.
Please, follow these steps:
- Add on root build.gradle:
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.1'
- Add on app build.gradle:
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
implementation ('com.onesignal:OneSignal:3.10.5')
- Set android studio in online mode, sync gradle and run the project
- Set android studio in offline mode, sync gradle and run the project
Now, you have these errors:
Could not resolve com.google.android.gms:play-services-base:[15.0.0, 16.0.0). Required by: project :app > com.onesignal:OneSignal:3.10.5 > No cached version listing for com.google.android.gms:play-services-base:[15.0.0, 16.0.0) available for offline mode. Could not resolve com.google.android.gms:play-services-basement:[15.0.1,16.0.0). Required by: project :app > com.google.android.gms:play-services-location:15.0.1 project :app > com.google.android.gms:play-services-places-placereport:15.0.1 > No cached version listing for com.google.android.gms:play-services-basement:[15.0.1,16.0.0) available for offline mode. Could not resolve com.google.android.gms:play-services-tasks:[15.0.1,16.0.0). Required by: project :app > com.google.android.gms:play-services-location:15.0.1 > No cached version listing for com.google.android.gms:play-services-tasks:[15.0.1,16.0.0) available for offline mode.
thank you and this solved my problem , must update onesignal document for this
Status
Status section + Issue header added by @jkasten2
Issue
It's simple. I've imported:
implementation ('com.onesignal:OneSignal:3.10.5')
andapply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
but when I try to speed up the gradle build, I get this error: