react-native-code-push icon indicating copy to clipboard operation
react-native-code-push copied to clipboard

Android RN 0.60 Dependency Resolution Error

Open andrewhartwig opened this issue 7 years ago • 21 comments

Sorry for ditching the template, I was just hoping someone would know better than I how to resolve these dependency errors from my debug/prod builds.

Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':react-native-code-push:compileDebugAidl'.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[1.3.1
  ,2.3]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
  
  Dependency failing: com.nimbusds:nimbus-jose-jwt:5.1 -> net.minidev:json-smart@[1.3.1,2.3], but json-smart version was 2
  .3.
  
  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 on project 'react' which depends onto net.minidev:json-smart@{strictly 2.3}
  -- Project 'app' depends on project 'react' which depends onto com.nimbusds:nimbus-jose-jwt@{strictly 5.1}
  -- Project 'app' depends on project 'react' which depends onto com.nimbusds:[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 2s

    at checkExecSyncError (child_process.js:616:11)
    at execFileSync (child_process.js:634:13)
    at runOnAllDevices (/Users/andrew/code/tokein/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:75:39)
    at buildAndRun (/Users/andrew/code/tokein/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:137:41)
    at then.result (/Users/andrew/code/tokein/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:103:12)
    at process._tickCallback (internal/process/next_tick.js:68:7)

andrewhartwig avatar Jul 24 '19 15:07 andrewhartwig

I reproduce this on RN 0.60.4

fungilation avatar Jul 25 '19 20:07 fungilation

Anyone manage to resolve this?

I use apply plugin: 'com.google.gms.google-services' to support another library and commenting it out seems to solve this. However, it crashes my app due to other dependencies.

ntelkedzhiev avatar Aug 06 '19 11:08 ntelkedzhiev

I have the exact same error and at least for now I added this com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true at the very bottom of android/app/build.gradle and worked

gedu avatar Aug 06 '19 12:08 gedu

I am currently facing this issue in a project which has Firebase and Code Push. Do we have some sort of stable solution other than skipping the version check?

ghoshabhi avatar Sep 03 '19 20:09 ghoshabhi

There is something I am still confused about - Does CodePush have a hard requirement for v4.2 of Google Play Services ? Why aren't the changes backward compatible ?

ghoshabhi avatar Sep 03 '19 20:09 ghoshabhi

I have the exact same error and at least for now I added this com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true at the very bottom of android/app/build.gradle and worked

This works for me as well, but instead of com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

I used googleServices { disableVersionCheck = true }

Starting with com.google.gms:google-services:4.3.0 you must now instead add the above line of code to the bottom of your app/build.gradle, after the apply.

nikhilasrani avatar Oct 10 '19 14:10 nikhilasrani

Hi there! I'm a react-native-firebase maintainer. This is the root cause of a lot of suffering in our repositories issue tracker.

Seems like it's actually an upstream bug in the google-services library not reading the range correctly; https://github.com/google/play-services-plugins/issues/30 - hopefully fixed soon by https://github.com/google/play-services-plugins/pull/92

Tangentially related 1:

Here's the JWT changelog, maybe an upgrade would be okay? https://bitbucket.org/connect2id/nimbus-jose-jwt/src/master/CHANGELOG.txt

Tangentially related 2:

Unrelated but still in gradle land, the gradle plugin referenced here is astoundingly out of date and it's pulled in at build time to the projects of users of this library: https://github.com/microsoft/react-native-code-push/blob/master/android/build.gradle#L8

There is a good community solution for the general problem of out-of-date/out-of-sync gradle plugin references in projects though, here is a commit implementing it, with a reference to the discussion: https://github.com/react-native-community/react-native-device-info/commit/394c4bdcd270e1d8fac1011f098411f5c3591e5d

mikehardy avatar Oct 15 '19 16:10 mikehardy

Upstream release 4.3.3 of google gradle plugin might fix this for everyone https://github.com/google/play-services-plugins/pull/92#issuecomment-553064608

mikehardy avatar Nov 12 '19 20:11 mikehardy

Thanks @mikehardy I updated to use 4.3.3

classpath("com.google.gms:google-services:4.3.3")

fixes the issue for me 👍

Another issue fixed by @mikehardy 👍 legend!

export-mike avatar Nov 20 '19 03:11 export-mike

Haha nice. I do love the ANZAC "legend" designation :-), but this one was just cross-pollinating and I had nothing to do with this fix other than being pesky in the plugin repo. I will be really happy to stop seeing this issue come up though that's for sure! Thanks for testing. @andrewhartwig - if you test now this might be closable 🍾

mikehardy avatar Nov 20 '19 15:11 mikehardy

Thanks @mikehardy I updated to use 4.3.3

classpath("com.google.gms:google-services:4.3.3")

fixes the issue for me 👍

Another issue fixed by @mikehardy 👍 legend!

this worked for me. Thanks

adescode avatar Dec 25 '19 19:12 adescode

Thanks @mikehardy I updated to use 4.3.3

classpath("com.google.gms:google-services:4.3.3")

fixes the issue for me 👍

Another issue fixed by @mikehardy 👍 legend!

Its work for me

snkhan120 avatar Jan 21 '20 10:01 snkhan120

@export-mike where to put this line of code ?

byteab avatar Feb 02 '20 07:02 byteab

@EhsanSarshar in your gradle config files. But you also have to call it. Whatever module you're integrating that uses google services should have documentation, and there might be other things you are missing so it might be good to go over it again. But this specific plugin is referenced and used like these two lines here in my react-native-firebase demonstrator script https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-v6.sh#L23

mikehardy avatar Feb 02 '20 15:02 mikehardy

@EhsanSarshar

android/build.gradle

buildscript {
...
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.2")
        classpath 'com.google.gms:google-services:4.3.3' // Put here
        classpath 'io.fabric.tools:gradle:1.28.1'
        

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
...
}

JeffGuKang avatar Feb 06 '20 07:02 JeffGuKang

Hi @andrewhartwig, Thank you for reporting!

Unfortunately, I cannot reproduce your issue, could you give more context and indicate the versions of react-native and react-native-code-push that you are using.

Not so long ago we released a new version of Code Push which supports react-native v0.60-v0.61. It may solve your problem. All steps for installing the latest version of the plugin are described in our documentation. iOS: https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-ios.md Android: https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-android.md

I'm going to close this issue for now. Please feel free to reopen it if you have any questions or issues.

andreidubov avatar Feb 14 '20 06:02 andreidubov

I am facing this issue on react native 0.61

Running react-native info:

System:
    OS: macOS 10.15.5
    CPU: (4) x64 Intel(R) Core(TM) i5-4260U CPU @ 1.40GHz
    Memory: 41.43 MB / 4.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 10.16.1 - /usr/local/bin/node
    Yarn: 1.19.0 - /usr/local/bin/yarn
    npm: 6.13.7 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6241897
    Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: ^0.61.0 => 0.61.5 
  npmGlobalPackages:
    react-native-cli: 2.0.1
    react-native-git-upgrade: 0.2.7

The react-native-code-push version I am using is 6.2.0 Running react-native run-android gives me the following error:

BUILD FAILED in 13s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':react-native-code-push:compileDebugAidl'.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[1.3.1
  ,2.3]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
  
  Dependency failing: com.nimbusds:nimbus-jose-jwt:5.1 -> net.minidev:json-smart@[1.3.1,2.3], but json-smart version was 2
  .3.
  
  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 on project 'react' which depends onto net.minidev:json-smart@{strictly 2.3}
  -- Project 'app' depends on project 'react' which depends onto com.nimbusds:nimbus-jose-jwt@{strictly 5.1}
  -- Project 'app' depends on project 'react' which depends onto com.nimbusds:[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 13s

    at checkExecSyncError (child_process.js:629:11)
    at execFileSync (child_process.js:647:13)
    at runOnAllDevices (/Users/ayodev/Desktop/workspace/ayo_passageiro/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
    at buildAndRun (/Users/ayodev/Desktop/workspace/ayo_passageiro/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:179:41)
    at then.result (/Users/ayodev/Desktop/workspace/ayo_passageiro/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:133:12)
    at process._tickCallback (internal/process/next_tick.js:68:7)

quixote15 avatar Sep 11 '20 14:09 quixote15

I have the exact same error and at least for now I added this com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true at the very bottom of android/app/build.gradle and worked

I had the same issue and it was resolved by adding this to the end of the file.

You save the day Thanks! 😊

niroshanjwm avatar Mar 29 '21 03:03 niroshanjwm

This should not be necessary with current versions of the google services plugin.

mikehardy avatar Mar 29 '21 12:03 mikehardy

Yup, since some RN versions ago above 0.60.4 when I reproduced this issue, the fix at https://github.com/microsoft/react-native-code-push/issues/1640#issuecomment-540608538 is no longer needed

fungilation avatar Mar 29 '21 18:03 fungilation