Onesignal-android-sdk: Dependency failing: com.onesignal:OneSignal:3.12.6 -> com.google.android.gms:play-services-base@[10.2.1, 16.1.99], but p lay-services-base version was 17.1.0.

Created on 25 Feb 2020  路  8Comments  路  Source: OneSignal/OneSignal-Android-SDK

Description:

Dependency failing: com.onesignal:OneSignal:3.12.6 -> com.google.android.gms:play-services-base@[10.2.1, 16.1.99], but p
  lay-services-base version was 17.1.0.

Environment
1.
minSdk = 21
targetSdk = 29
compileSdk = 29

  1. maven (following the guide: https://documentation.onesignal.com/docs/android-sdk-setup)

Steps to Reproduce Issue:

  1. Add the OneSignal SDK to your project
  2. Place your App ID in the application's gradle file
  3. Add following firebase dependencies:
    firebase Auth "19.2.0"
    firebase Database "19.2.1"
    firebase DynamicLinks "19.0.0"

Result: BUILD FAILED

Anything else:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugAidl'.
> In project 'data' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[10.2
  .1, 16.1.99]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

  Dependency failing: com.onesignal:OneSignal:3.12.6 -> com.google.android.gms:play-services-base@[10.2.1, 16.1.99], but p
  lay-services-base version was 17.1.0.

  The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
  ifact with the issue.
  -- Project 'data' depends on project 'app' which depends onto com.google.firebase:firebase-auth@{strictly 19.2.0}
  -- Project 'data' depends on project 'app' which depends onto com.onesignal:OneSignal@{strictly 3.12.6}
  -- Project 'data' depends on project 'app' which depends onto com.google.firebase:[email protected]
  -- Project 'data' depends on project 'app' which depends onto com.google.firebase:firebase-database@{strictly 19.2.1}
  -- Project 'data' depends onto com.google.firebase:firebase-iid@{strictly 19.0.0}
  -- Project 'data' depends onto com.google.firebase:firebase-analytics@{strictly 17.2.0}
  -- Project 'data' depends onto com.google.android.gms:play-services-measurement-api@{strictly 17.2.0}
  -- Project 'data' depends on project 'app' which depends onto com.google.firebase:firebase-auth-interop@{strictly 19.0.0
  }
  -- Project 'data' depends onto com.google.android.gms:play-services-base@{strictly 17.0.0}
  -- Project 'data' depends on project 'app' which depends onto com.google.firebase:[email protected]
  -- Project 'data' depends on project 'app' which depends onto com.google.android.gms:play-services-location@{strictly 15
  .0.1}
  -- Project 'data' depends on project 'app' which depends onto com.google.android.gms:play-services-base@{strictly 17.1.0
  }
  -- Project 'data' depends on project 'app' which depends onto com.google.firebase:firebase-messaging@{strictly 20.0.0}
  -- Project 'data' depends onto com.google.firebase:[email protected]
  -- Project 'data' depends onto com.google.firebase:firebase-iid-interop@{strictly 17.0.0}
  -- Project 'data' depends on project 'app' which depends onto com.google.firebase:firebase-analytics@{strictly 17.2.0}
  -- Project 'data' depends on project 'app' which depends onto com.google.firebase:firebase-iid@{strictly 20.0.0}
  -- Project 'data' depends on project 'app' which depends onto com.onesignal:OneSignal@[3.11.2, 3.99.99]
  -- Project 'data' depends on project 'app' which depends onto com.google.firebase:firebase-iid-interop@{strictly 17.0.0}
  -- Project 'data' depends on project 'app' which depends onto com.google.android.gms:play-services-measurement-api@{stri
  ctly 17.2.0}
  -- Project 'data' depends on project 'app' which depends onto com.google.firebase:firebase-dynamic-links@{strictly 19.0.
  0}
  -- Project 'data' depends on project 'app' which depends onto com.google.firebase:[email protected]
  -- Project 'data' depends on project 'app' which depends onto com.google.firebase:[email protected]
  -- Project 'data' depends on project 'app' which depends onto com.google.firebase:[email protected]

  For extended debugging info execute Gradle from the command line with ./gradlew --info :data:assembleDebug to see the de
  pendency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https:/
  /github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your 
  build.gradle file.
Needs More Information

Most helpful comment

In your app/build.gradle where you applied the plugin
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
make sure it is before
apply plugin: "com.android.application"
Android studio also gives a warning if the order of the above statements is not correct.

All 8 comments

In your app/build.gradle where you applied the plugin
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
make sure it is before
apply plugin: "com.android.application"
Android studio also gives a warning if the order of the above statements is not correct.

@mohsinriaz17 I confirm it's correctly placed

@iamcharleych It looks like you have a :data project and a :app project in your workspace. This might be the cause of why the onesignal-gradle-plugin isn't working due to a limitation with it.

What is the relationship between your :data and :app projects? Care you share the dependencies between them?

Which dependencies do you have in each project?

Sharing all yourbuild.gradle files should give us answers to the above.

app module:
implementation project(':data')

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'com.google.firebase:firebase-dynamic-links:19.0.0'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-database:19.2.1'

data module:
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.firebase:firebase-analytics:17.2.0'

@iamcharleych Thanks for the details, we need a few more details however.

Is the following line in your :app or :data project?

apply plugin: 'com.google.gms.google-services'

Also just to confirm, apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin' is only in your :app?

And lastly is implementation 'com.onesignal:OneSignal:[3.11.2, 3.99.99]' only in your :app target?

In the mean time you can add googleServices { disableVersionCheck = false } to your build.gradle to work around the issue. However if your dependencies are too different you may see a build or runtime error.

Is the following line in your :app or :data project?

apply plugin: 'com.google.gms.google-services'

both - in :app and :data modules

Also just to confirm, apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin' is only in your :app?

Yes, only in :app module

And lastly is implementation 'com.onesignal:OneSignal:[3.11.2, 3.99.99]' only in your :app target?

Yes, only in :app module

In the mean time you can add googleServices { disableVersionCheck = false } to your build.gradle to work around the issue. However if your dependencies are too different you may see a build or runtime error.

I'll try it soon, but I'd like not to proceed with that workaround

Thanks!

@iamcharleych Per Google's docs you should only have apply plugin: 'com.google.gms.google-services' in your app/build.gradle.
https://developers.google.com/android/guides/google-services-plugin

After you remove this from your :data module / project your error will most likely be solved. Let us know if that was it!

@jkasten2 Yeah, it works!
The issue can be closed now
Thanks a lot !

Was this page helpful?
0 / 5 - 0 ratings