Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency problem after added react-native-firebase #957

Closed
lord22shark opened this issue Mar 12, 2020 · 11 comments
Closed

Dependency problem after added react-native-firebase #957

lord22shark opened this issue Mar 12, 2020 · 11 comments

Comments

@lord22shark
Copy link

Description:

My react-native application, using react-native-onesignal was working perfectly but due to iOS problems I had to change "firebase" to "react-native-firebase". After added classpath("com.google.gms:google-services:4.3.3") to android/build.gradle and apply plugin: "com.google.gms.google-services" to android/app/build.gradle OneSignal start conflict dependencies, as the following message describes:

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.7 -> com.google.android.gms:play-services-location@[10.2.1, 16.0.99], but 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 artifact with the issue.
-- Project 'app' depends onto com.onesignal:OneSignal@{strictly 3.12.7}
-- Project 'app' depends on project 'react' which depends onto com.onesignal:[email protected]
-- Project 'app' depends onto com.google.android.gms:play-services-location@{strictly 16.0.0}

Environment

react-native-onesignal:^3.6.0. Already tried with react-native-onesignal: ^3.6.5
All dependencies were added by yarn

yarn add react-native-onesignal
yarn add @react-native-firebase/app
yarn add @react-native-firebase/auth
yarn add @react-native-firebase/database

Steps to Reproduce Issue:

As my application is an existing application, I just added the firebase dependencies. I guess that to reproduce this error, from scratch, just adding react-native-onesignal and than adding react-native-firebase dependencies and try to run might cause this dependency problem.

Anything else:

Dependency resolved to an incompatible version: Dependency(fromArtifactVersion=ArtifactVersion(groupId=com.onesignal, artifactId=OneSignal, version=3.12.7), toArtifact=Artifact(groupId=com.google.android.gms, artifactId=play-services-location), toArtifactVersionString=[10.2.1, 16.0.99])

@mostafaebrahimi
Copy link

same problem here!
any solution?

@jkasten2
Copy link
Member

@mostafaebrahimi These dependency issue should be resolved after adding the onesignal-gradle-plugin to your project. Please follow the Adding the Gradle Plugin section in the OneSignal React Native setup guide.

@dancherb
Copy link

I'm experiencing this issue even with the gradle plugin added as described. @jkasten2

@rgomezp
Copy link
Contributor

rgomezp commented Apr 8, 2020

Howdy y'all,
Based on previous responses, this is likely a dependency management issue that needs to be added to the Gradle Plugin. Thanks for your patience.

If anyone figures out which specific version ranges/combinations fix the issue, please let us know!

@rgomezp rgomezp reopened this Apr 13, 2020
@rgomezp
Copy link
Contributor

rgomezp commented Apr 22, 2020

@dancherb ,
Can you please include how you added the Gradle plugin to your project?

@itsmicaio
Copy link

I'm fix this issue changing the version from classpath("com.google.gms:google-services:4.3.3") to classpath("com.google.gms:google-services:4.2.0")

@rgomezp
Copy link
Contributor

rgomezp commented May 12, 2020

@itsmicaio ,
Sorry, I mean the OneSignal Gradle Plugin.

@chrisd1997
Copy link

@rgomezp My build.gradle files are in different folders for my React Native project.

I've added the following to my android/build.gradle:

dependencies {
        classpath("com.android.tools.build:gradle:3.5.2")
        classpath('com.google.gms:google-services:4.3.3')
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.99.99]' <--- added this

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
        maven { url 'https://plugins.gradle.org/m2/' } <-- added this
    }
}

In my android/app/build.gradle I've added the following:

apply plugin: "com.android.application"
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin' <--- added this
apply plugin: 'com.google.gms.google-services'

Which ends up in:

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> 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.13.2 -> 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:[email protected]
  -- Project 'app' depends onto com.google.android.gms:play-services-location@{strictly 16.0.0}
  -- Project 'app' depends onto com.onesignal:OneSignal@{strictly 3.13.2}
  -- Project 'app' depends on project 'react' which depends onto com.onesignal:[email protected]

@rgomezp
Copy link
Contributor

rgomezp commented May 28, 2020

Howdy,
Thanks for your patience. We'll take a look at whether there is a possible conflict here and whether it can be fixed easily.

@jkasten2
Copy link
Member

@chrisd1997
Can you make sure you have com.google.gms.google-services at the very bottom of your android/app/build.gradle below the dependencies {} section?
apply plugin: 'com.google.gms.google-services'

You can also try adding googleServices { disableVersionCheck = true } to your build.gradle but it shouldn't be required as onesignal-gradle-plugin should be doing this already.
OneSignal/OneSignal-Gradle-Plugin#37 (comment)

@rgomezp
Copy link
Contributor

rgomezp commented Jun 16, 2020

Closing due to no response

@rgomezp rgomezp closed this as completed Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants