React-native-onesignal: a resolved Google Play services library dependency depends on another at an exact version (e.g. "[10.2. 1, 16.0.99]", but isn't being resolved to that version.

Created on 17 Dec 2019  ·  17Comments  ·  Source: OneSignal/react-native-onesignal

Description:

I installed react-native-onesignal as per the documentation. It is working just fine on iOS, but it is causing biuld issues on the android side relating to Google Play service dependencies. It does seem to go through if I downgrade to google-services from 4.2.0 to 4.1.0, but unfortunately, downgrading breaks several of my other dependencies.

I have seen this issue logged in a few places on the android side, which leads me to believe that there is an issue with the latest version of the android SDK that is supported by this react-native library:

https://github.com/OneSignal/OneSignal-Android-SDK/issues/894
https://stackoverflow.com/questions/59128152/error-in-project-app-a-resolved-google-play-services-library-dependency-depen

Here is the error I am receiving:

> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[10.2.
  1, 16.0.99]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

  Dependency failing: com.onesignal:OneSignal:3.12.3 -> com.google.android.gms:play-services-location@[10.2.1, 16.0.99], b
  ut play-services-location version was 15.0.1.

  The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
  ifact with the issue.
  -- Project 'app' depends onto com.google.android.gms:play-services-location@{strictly 15.0.1}
  -- Project 'app' depends onto com.onesignal:OneSignal@{strictly 3.12.3}
  -- Project 'app' depends on project 'react' which depends onto com.onesignal:[email protected]

Environment

  1. react-native-onesignal version 3.6.0
  2. yarn and react-native link

Steps to Reproduce Issue:

  1. Install the OneSignal SDK using yarn into the project
  2. Use google-services version 4.2.0 and the onesignal-gradle-plugin to the gradle buildscript:
buildscript {
  ...
  repositories {
    ...
    maven {
            url 'https://plugins.gradle.org/m2/'
        }
  }
  dependencies {
    ...
    classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.1, 0.99.99]'
    classpath 'com.google.gms:google-services:4.2.0'
  }
}
  1. Apply the gradle plugin after the buildscript
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
  1. Attempt to build start the android app
react-native run-android

Anything else:

Help Wanted

Most helpful comment

Try to declare onesignal-gradle-plugin before google-services in androidappbuild.gradle:

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.google.gms.google-services'

All 17 comments

I'm getting this same issue too.

FAILURE: Build failed with an exception.

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

  Dependency failing: com.onesignal:OneSignal:3.12.3 -> com.google.android.gms:play-services-location@[10.2.1, 16.0.99], b
  ut play-services-location version was 16.0.0.

  The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
  ifact with the issue.
  -- Project 'app' depends onto com.google.android.gms:play-services-location@{strictly 16.0.0}
  -- Project 'app' depends onto com.onesignal:OneSignal@{strictly 3.12.3}
  -- Project 'app' depends on project 'react' which depends onto com.onesignal:[email protected]

  For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
  endency 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 b
  uild.gradle file.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 15s

@Esirei What version of react-native-onesignal are you using?

Same issue on 3.6.1:

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

  Dependency failing: com.onesignal:OneSignal:3.12.4 -> com.google.android.gms:play-services-location@[10.2.1, 16.0.99], b
  ut play-services-location version was 15.0.1.

  The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
  ifact with the issue.
  -- Project 'app' depends onto com.google.android.gms:play-services-location@{strictly 15.0.1}
  -- Project 'app' depends onto com.onesignal:OneSignal@{strictly 3.12.4}
  -- Project 'app' depends on project 'react' which depends onto com.onesignal:[email protected]

  For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
  endency 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 b
  uild.gradle file.

Downgrading to 3.4.2 fixes the issue for me.

Can you please make sure you have the latest version of the OneSignal Gradle Plugin?

@rgomezp I tried installing the latest onesignal version, which includes the 3.12.4 version of the OneSignal gradle plugin. However, that still threw an error.

It appears that the 3.12.* Android SDK is incompatible with google-services 4.2.

Try to declare onesignal-gradle-plugin before google-services in androidappbuild.gradle:

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.google.gms.google-services'

As @allumina says above, you have to edit the appbuild.gradle file according to the docs.

@Esirei What version of react-native-onesignal are you using?

v3.6.1

Earlier, adding onesignal-gradle-plugin to gradle file step was not there. I think while upgrading, that caused it not to compile. Adding those fixed my issue.

This seems to be resolved for now. Thanks for everyone's participation

@rgomezp I don't believe this was fixed. Everyone here just found workarounds, such as downgrading. I believe this is still very much an issue.

I don't see any responses from OneSignal other than "please make sure you install the latest version", which was not helpful.

@rgomezp I tried installing the latest onesignal version, which includes the 3.12.4 version of the OneSignal gradle plugin. However, that still threw an error.

It appears that the 3.12.* Android SDK is incompatible with google-services 4.2.

@cmcaboy The OneSignal Gradle Plugin is an independent of component from the OneSignal Android Native SDK and isn't included automatically.
Please double check you have correctly followed the Adding the Gradle Plugin section in the React Native OneSignal setup guide.

Try to declare onesignal-gradle-plugin before google-services in androidappbuild.gradle:

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.google.gms.google-services'

Thanks It works for me.

In app/build.gradle I added this line:
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.12.6'
}

Try to declare onesignal-gradle-plugin before google-services in androidappbuild.gradle:

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.google.gms.google-services'

@allumina
Works for me. Thanks

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.google.gms.google-services'

@allumina
Works for me. Thanks ☺️ 👍

I'm still experiencing the issue, the above solutions did not work for me, can anyone share his/her entire gradle files?

Was this page helpful?
0 / 5 - 0 ratings