React-native-code-push: Dependency failing: com.nimbusds:nimbus-jose-jwt:5.1 -> net.minidev:json-smart@[1.3.1,2.3]

Created on 10 Nov 2018  路  54Comments  路  Source: microsoft/react-native-code-push

Thanks so much for filing an issue or feature request! Please fill out the following (wherever relevant):

Steps to Reproduce

When trying to run our Android project (react-native), this fails.

Expected Behavior

What you expected to happen?

The Android app to be compiled.

Actual Behavior

What actually happens?

The compilation of our react-native app (Android) fails quite early, by throwing this error message:

  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 com.nimbusds:[email protected]

Reproducible Demo

Environment

  • react-native-code-push version: ^5.4.2
  • react-native version: 16.6,1
  • iOS/Android/Windows version:
  • Does this reproduce on a debug build or release build?
  • Does this reproduce on a simulator, or only on a physical device?

(The more info the faster we will be able to address it!)

bug investigating

Most helpful comment

@alexandergoncharov

The issue occurs when using v4.2.0 of the google-services plugin & codepush
E.g.

classpath 'com.google.gms:google-services:4.2.0'

Downgrading to v4.1.0 works around this issue temporarily.

All 54 comments

Hi @afilp ,
Thanks for reporting!

It is strange issue. Could you please provide some dummy project with reproducing issue? I would like to debug it.

Thanks,
Alexander

@alexandergoncharov Thanks for your fast reply, the project I am using is rather complicated to make it simpler and submit it here.

I can say for sure that the problem arises when we are using apply plugin: 'com.google.gms.google-services' in order to support the react-native-firebase. (as explained in their installation doc here: https://rnfirebase.io/docs/v5.x.x/installation/android )

Something is used in google-services related to net.minidev:json-smart that conflicts with your use of net.minidev:json-smart (in versioning).

I had to comment out apply plugin: 'com.google.gms.google-services' and the conflict ceased to exist BUT this then made react-native-firebase unusable (crashes).

I have added a similar issue there too, in case you want to co-investigate the problem:
https://github.com/invertase/react-native-firebase/issues/1676

Thank you!

Hello, I am not sure what else to do, as I am not entitled to send the private project here.

Is there a resolution setting I could use?

I am not sure what this message means:

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.

Based on the above, isn't 2.3 OK?

Hi @afilp ,
Sorry for delay.

It is strange issue as I have also com.nimbusds:nimbus-jose-jwt:5.1 and net.minidev:json-smart:2.3 in my dummy project and all works correct.
Could you please share your android/app/build/intermediates/transforms/dexBuilder/debug/__content__.json file, build.gradle file from root folder and app/build.gradle file?
I would like to reproduce your issue and investigate it.

@alexandergoncharov

The issue occurs when using v4.2.0 of the google-services plugin & codepush
E.g.

classpath 'com.google.gms:google-services:4.2.0'

Downgrading to v4.1.0 works around this issue temporarily.

Please see here, the following seems to have worked!
https://github.com/invertase/react-native-firebase/issues/1676

Please see here, the following seems to have worked!
invertase/react-native-firebase#1676

try to add

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

at the bottom of android/app/build.gradle

Hi @AlMel3000 , @AndrewJack , thanks for providing workarounds.

I reproduced issue. My investigation in progress.

Hi @alexandergoncharov any update on this issue ? i guess we have to use google service 4.2.0 on Android Gradle Plugin 3.3, or we will got runtime error (it happened on my project):
https://stackoverflow.com/questions/52374463/googleservice-failed-to-initialize-status-10-missing-google-app-id-value-from/54200175#54200175

While i still got this error when using google service 4.2.0.

Thanks !

Any resolution for this issue? I confirm the problem.

Any solution ?

I think this may be due to an issue with the version checker itself: https://github.com/google/play-services-plugins/issues/30

The error is kind of confusing in the first place. It's saying the resolved version 2.3 isn't compatible with the version required [1.3.1,2.3]. The square bracket syntax is supposed to be an inclusive range meaning [from_version, to_version] - so having the version resolve to 2.3 should be supported, as the acceptable range is up to and including 2.3.

However, the version checker at the moment is essentially saying

if (there are square brackets) {
  make sure the string within the brackets _exactly_ matches the resolved version
} else {
  any versions are compatible
}

Which is a bit odd, since we'd only use those square brackets when we would have two versions to compare between - so any use of [from_version, to_version] would throw an error. Unless of course, you used the brackets to indicate only one version [version], which is completely unnecessary.

Given that the only instance that the version checker _is actually doing its job_ is broken right now, I think it should be safe to disable the version check like @AlMel3000 said:

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

Until a fix drops for https://github.com/google/play-services-plugins/issues/30, I'm not sure there's any other solution - or honestly any benefit to using that version checker in the first place.

_(disclaimer, this is only from recent research after digging into this error)_

If the version checker has a bug, could a hotfix with it disabled be merged and released until the upstream fix is in place?

It hit me today with following while running simple build on my project;

[ERROR] Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:1.2.2:package (package-azure-functions) on project ms-holdings-package-azure: Execution package-azure-functions of goal com.microsoft.azure:azure-functions-maven-plugin:1.2.2:package failed: Plugin com.microsoft.azure:azure-functions-maven-plugin:1.2.2 or one of its dependencies could not be resolved: Failed to collect dependencies at com.microsoft.azure:azure-functions-maven-plugin:jar:1.2.2 -> com.microsoft.azure:azure-maven-plugin-lib:jar:1.2.7 -> com.microsoft.azure:azure:jar:1.17.1 -> com.microsoft.azure:azure-client-authentication:jar:1.6.3 -> com.microsoft.azure:adal4j:jar:1.6.2 -> com.nimbusds:oauth2-oidc-sdk:jar:5.64.4 -> net.minidev:json-smart:jar:[1.3.1,2.3]: No versions available for net.minidev:json-smart:jar:[1.3.1,2.3] within specified range -> [Help 1]

Azure maven Plugin Version Tried: 1.3.0, 1.3.1, 1.2.2

It was working fine previously, somehow maven is trying to resolve [1.3.1,2.3] of net.minidev as is instead of ranges it seems. I have verified and library is available with these version on maven central.

Anyone else found a workaround!

Solution:

You can solve this problem by adding this to your "app/build.gradle" dependencies :

dependencies {
  components.all {
    allVariants {
      withDependencies { deps ->
        deps.each { dep ->
          if (dep.group == 'net.minidev' && dep.name =='json-smart') {
            dep.version {
                prefer "2.3"
            }
            dep.because "resolving dependencies issue"
          }
        }
      }
    }
  }
  ..... other dependencies
}

Update:

Invalidate the cache and restart Android studio after you apply the changes.

Since I know that my project works with version 2.3, using component metadata project you can ignore whatever version other components want (you take the responsibility).
With :

classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'

@BachirKhiati
Thx for this solution. It is a lot more specific than just disabling the version check all together. 馃憤
Unfortunately it somehow doesn't work if I select Rebuild Project from the Build menu.
No clue why this behaves differently than a normal gradle sync.

@jonas-arkulpa would you mind to share your build.gradle content here? I've tried the solution above yet I've not managed to make it work here, perhaps I'm missing something...

@vinicarra Unfortunately, I can't provide you more information about this project.
But I basically copy pasted @BachirKhiati's solution and the sync worked as expected.

@jonas-arkulpa I have nothing to do with this issue. :) I think you meant to mention @vinicarra

@BachirKhiati , can you please post your entire gradle file, i am unable to run it after copy pasting your solution

I'm having the same issue after updating to react native 0.59.

@jonas-arkulpa, @pallaviMN
Did you invalidate the cache in Android studio after you did the changes? That should solve the problem.

This solution worked for me.

If you have included implementation project(':react-native-code-push') and you are definitely importing this dependency from another project then you can exclude this dependency in the react-native-code-push project.

Modify this line to your build.gradle in the react-native-code-push project.

compile 'com.nimbusds:nimbus-jose-jwt:5.1' ->
compile('com.nimbusds:nimbus-jose-jwt:5.1') { exclude group: "net.minidev", module: "json-smart" }

Hi @AlMel3000 , @AndrewJack , thanks for providing workarounds.

I reproduced issue. My investigation in progress.

Hi, Have you got any workaround?

I think this may be due to an issue with the version checker itself: google/play-services-plugins#30

The error is kind of confusing in the first place. It's saying the resolved version 2.3 isn't compatible with the version required [1.3.1,2.3]. The square bracket syntax is supposed to be an inclusive range meaning [from_version, to_version] - so having the version resolve to 2.3 should be supported, as the acceptable range is up to and including 2.3.

However, the version checker at the moment is essentially saying

if (there are square brackets) {
  make sure the string within the brackets _exactly_ matches the resolved version
} else {
  any versions are compatible
}

Which is a bit odd, since we'd only use those square brackets when we would have two versions to compare between - so any use of [from_version, to_version] would throw an error. Unless of course, you used the brackets to indicate only one version [version], which is completely unnecessary.

Given that the only instance that the version checker _is actually doing its job_ is broken right now, I think it should be safe to disable the version check like @AlMel3000 said:

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

Until a fix drops for google/play-services-plugins#30, I'm not sure there's any other solution - or honestly any benefit to using that version checker in the first place.

_(disclaimer, this is only from recent research after digging into this error)_

I also investigated this from my end.

Is there any chance that this is addressed soon? All proposed solutions boil down to mess with the build process to ignore version mismatches. This may be a solution for building, but might lead to runtime crashes. For me this is a really serious issue, as having code-push and firebase in one project seems to be a typical use case for many react-native apps.

@ruipaulo yeah you are absolutely correct.

Any update on this?

@alexandergoncharov would be great if the team could fix this.

We are waiting for this

+1

No solutions worked for me!

+1

Having an issue with react native 0.59.10

+1

Nothing worked for me!

Having an issue with react native 0.59.9

downgrading the distributionUrl in gradle-wrapper.properties worked for me:
from distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
todistributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip

@BachirKhiati your solution doesn't work using latest gradle distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
any update !?

@alexandergoncharov any update on a solution for this?

@BachirKhiati your solution doesn't work using latest gradle distributionUrl=https://services.gradle.org/distributions/
any update !?

@MinaFSedrak , Yes, it is outdated now but I was able to successfully compile and run my project with:
distributionUrl=https://services.gradle.org/distributions/gradle-5.4.1-all.zip
using:
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.google.gms:google-services:4.2.0'
adding at the bottom of android/app/build.gradle :
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

@BachirKhiati couldn't this lead in runtime errors ^

+1

Nothing worked for me!

What's going on with codepush? No answers on this urgent issue for months? Microsoft used to be super responsive on GH ....? I start considering to drop CodePush/AppCenter.

I made it work by adding com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true at the bottom of android/app/build.gradle. I also have multiDexEnabled true inside defaultConfig -> android -> android/app/build.gradle

downgrading classpath 'com.google.gms:google-services:4.2.0' to 4.1.0 makes the build however causes issues with Firebase

I have not experienced problems in runtime for now. I believe this is a temporary fix only anyways and MS should fix this

Looks like it's time to remove code push. MS support here is atrocious.

Any update on the issue?

May be help for who still face this issue: refer from https://github.com/OneSignal/OneSignal-Gradle-Plugin/issues/37

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

googleServices { disableVersionCheck = true }

My version is: classpath 'com.google.gms:google-services:4.3.2'

This solution has been proposed in this issue.
It's working yes but this should be a temporary fix, we expect a real fix but it seems this library is deprecated. No information, no support from Microsoft since months...

@joan-saum this repository is alive but they're doing a bit of work under the covers I think to enable things like delta bundles etc. They have been responsive enough in that they confirm it does work on current react-native in one of the issues, and I've seen them active in other venues. So don't write the repo off ;-)

That said, this issue is not their fault. It's a problem with the google-services plugin, it has a PR that is unmerged but could maybe use community support / commentary to raise profile? https://github.com/google/play-services-plugins/pull/95

I was experiencing the same issue:

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]

I was seeing this after upgrading com.google.gms:google-services from version 4.1.0 to 4.2.0. However, this issue is no longer happening after upgrading to the latest version 4.3.3.

Fixed
apply plugin: 'com.google.gms.google-services'
googleServices {
disableVersionCheck = true
}

Fixed
apply plugin: 'com.google.gms.google-services'
googleServices {
disableVersionCheck = true
}

With the new plug in version this should no longer be necessary

changing google service version to 4.3.3 , the issue is gone, however it will mess up react-native-firebase

@callmejm false assertion, google services version 4.3.3 works wonderfully with react-native-firebase

Hi all!
Codepush works correctly with google services version 4.3.3 and fixes this issue. Does anyone have any issues?

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

panarasi picture panarasi  路  4Comments

Phredward picture Phredward  路  3Comments

djw27 picture djw27  路  3Comments

osdnk picture osdnk  路  3Comments

fanzhiri picture fanzhiri  路  3Comments