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 failing: com.nimbusds:nimbus-jose-jwt:5.1 -> net.minidev:json-smart@[1.3.1,2.3] #1448

Closed
afilp opened this issue Nov 10, 2018 · 92 comments
Assignees

Comments

@afilp
Copy link

afilp commented Nov 10, 2018

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:nimbus-jose-jwt@5.1

Reproducible Demo

  • Download https://github.com/Microsoft/react-native-code-push/archive/master.zip and unzip. From Examples folder run node create-app.js appName react-native@0.47.1 react-native-code-push@5.0.0-beta command to generate plain CodePushified React Native app. Please see description on top of create-app.js file content if needed
  • If you can't reproduce the bug on it, provide us as much info as possible about your project

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!)

@alexandergoncharov-zz
Copy link
Contributor

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

@afilp
Copy link
Author

afilp commented Nov 12, 2018

@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:
invertase/react-native-firebase#1676

Thank you!

@afilp
Copy link
Author

afilp commented Nov 21, 2018

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?

@alexandergoncharov-zz
Copy link
Contributor

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.

@AndrewJack
Copy link
Contributor

AndrewJack commented Nov 23, 2018

@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.

@afilp
Copy link
Author

afilp commented Nov 23, 2018

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

@AlMel3000
Copy link

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

@alexandergoncharov-zz
Copy link
Contributor

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

I reproduced issue. My investigation in progress.

@doniwinata0309
Copy link

doniwinata0309 commented Jan 18, 2019

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 !

@janakg
Copy link

janakg commented Feb 2, 2019

Any resolution for this issue? I confirm the problem.

@melihberberolu
Copy link

Any solution ?

@zachgibb
Copy link

zachgibb commented Mar 5, 2019

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)

@l3ender
Copy link

l3ender commented Mar 18, 2019

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

@junejosheeraz
Copy link

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!

@BachirKhiati
Copy link

BachirKhiati commented Apr 27, 2019

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'

@jonas-app
Copy link

@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.

@bonnmh
Copy link

bonnmh commented May 9, 2022

@congnguyen91 how do i know when it will be fixed

@hamza-novalabs
Copy link

Gradle is down today :v

Their status website seems to show that it's operational, yet I'm still getting the error.

@bonnmh
Copy link

bonnmh commented May 9, 2022

Gradle is down today :v

Their status website seems to show that it's operational, yet I'm still getting the error.

I also had the same problem, it worked fine in the past days

@ferasabufares
Copy link

+1 same here
Not working
i try all the solution but none of them are working with me

can you please give me a solution

@BhargaviOS
Copy link

BhargaviOS commented May 9, 2022

+1 same here
Getting same error like below

> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve net.minidev:json-smart:[1.3.1,2.3].
     Required by:
         project :app > project :react-native-code-push > com.nimbusds:nimbus-jose-jwt:5.1
      > Failed to list versions for net.minidev:json-smart.
         > Unable to load Maven meta-data from https://jcenter.bintray.com/net/minidev/json-smart/maven-metadata.xml.
            > Could not HEAD 'https://jcenter.bintray.com/net/minidev/json-smart/maven-metadata.xml'.
               > org.apache.http.client.ClientProtocolException (no error message)```

@kamal-j
Copy link

kamal-j commented May 9, 2022

+1
`
Could not determine the dependencies of task ':app:lintVitalRelease'.

Could not resolve all artifacts for configuration ':app:debugRuntimeClasspath'.
Could not resolve net.minidev:json-smart:[1.3.1,2.3].
Required by:
project :app > project :react-native-code-push > com.nimbusds:nimbus-jose-jwt:5.1
> Failed to list versions for net.minidev:json-smart.
> Unable to load Maven meta-data from https://jcenter.bintray.com/net/minidev/json-smart/maven-metadata.xml.
> Could not HEAD 'https://jcenter.bintray.com/net/minidev/json-smart/maven-metadata.xml'.
> org.apache.http.client.ClientProtocolException (no error message)`

@bansalakshay8
Copy link

+1. Facing similar issue.

Execution failed for task ':app:checkInd_devDebugAarMetadata'.

Could not resolve all files for configuration ':app:ind_devDebugRuntimeClasspath'.
Could not resolve net.minidev:json-smart:[1.3.1,2.3].
Required by:
project :app > project :react-native-code-push > com.nimbusds:nimbus-jose-jwt:5.1
> Failed to list versions for net.minidev:json-smart.
> Unable to load Maven meta-data from https://jcenter.bintray.com/net/minidev/json-smart/maven-metadata.xml.
> Could not HEAD 'https://jcenter.bintray.com/net/minidev/json-smart/maven-metadata.xml'.
> org.apache.http.client.ClientProtocolException (no error message)

@hiepns97it
Copy link

I fixed it by changing in react-native-code-push
node-module/react-native-code-push/android/app/build.gradle
edit line implementation('com.nimbusds:nimbus-jose-jwt:5.1') to implementation('com.nimbusds:nimbus-jose-jwt:5.1') { exclude group: "net.minidev", module: "json-smart" }

@congnguyen91
Copy link

I fix by add mavenCentral
Screen Shot 2022-05-09 at 12 12 38

@bansalakshay8
Copy link

I fix by add mavenCentral Screen Shot 2022-05-09 at 12 12 38

Thanks @congnguyen91 it worked. But do you think installing gradle dependencies from 3 different repo(jcenter,mavenLocal,mavenCentral), will impact any of the things?

@MKmurali241
Copy link

Thanks @congnguyen91 it worked.

@congnguyen91
Copy link

congnguyen91 commented May 9, 2022

@bansalakshay8 This impacts the time of building the app (maybe dependent on your network performance) a few of minutes - not the app's run time performance. But build successfully is better than error, let's be priority for devs.

@gattigaga
Copy link

I fix by add mavenCentral Screen Shot 2022-05-09 at 12 12 38

Hi, @congnguyen91...
Could you share the full content of that build.gradle file ?

Mine still failed to compile even I already put mavenCentral()...

@congnguyen91
Copy link

congnguyen91 commented May 9, 2022

Here you are @gattigaga

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "29.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
        firebaseMessagingVersion = "21.1.0"
        googlePlayServicesVersion   = "16.0.0"
        googlePlayServicesVisionVersion = "18.0.0"
        googlePlayServicesBase      = "16.0.1"
        supportLibVersion   = "28.0.0"
        kotlinVersion = "1.3.61"
        RNNKotlinVersion = kotlinVersion
    }
    repositories {
        google()
        mavenLocal()
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
        classpath 'com.android.tools.build:gradle:4.0.2'
        classpath 'com.google.gms:google-services:4.3.4'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'

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

allprojects {
    repositories {
        google()
        mavenLocal()
        mavenCentral()
        jcenter()

        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")
        }

        maven { url 'https://www.jitpack.io' }
    }
}

@gattigaga
Copy link

@congnguyen91 Thank you... :D

@congnguyen91
Copy link

congnguyen91 commented May 9, 2022

I fixed it by changing in react-native-code-push node-module/react-native-code-push/android/app/build.gradle edit line implementation('com.nimbusds:nimbus-jose-jwt:5.1') to implementation('com.nimbusds:nimbus-jose-jwt:5.1') { exclude group: "net.minidev", module: "json-smart" }

This may make your app built successfully but It contains the potential crash. This is only used if lib duplicated but different lib versions.

@ferasabufares
Copy link

mavenCentral()

thanks a lot <3
it is working

@ikbalmoh
Copy link

ikbalmoh commented May 9, 2022

I fix by add mavenCentral Screen Shot 2022-05-09 at 12 12 38

It's working for me, thanks

@hmphu
Copy link

hmphu commented May 9, 2022

+1 same problem. I tried https://status.jitpack.io/ but it's not working

@BradleyGyemi-Qlik
Copy link

+1 same problem but ours is failing on version 5.7

Could not resolve net.minidev:json-smart:[1.3.1,2.3].
Required by:
project : > com.nimbusds:nimbus-jose-jwt:5.7
> Failed to list versions for net.minidev:json-smart.

@A9K5
Copy link

A9K5 commented May 9, 2022

Gradle is down today :v

@congnguyen91 Where can we verify/check this ?
coz acc. to Gradle Status all is good !!

Edit: Seems Jcenter deprecation and End of Service might be the cause.[Update: 24-02-2021 of Android Developers Page:](https://developer.android.com/studio/build/jcenter-migration)

Stack overflow link(https://stackoverflow.com/a/50726436)

@increase21
Copy link

I fixed it by changing in react-native-code-push node-module/react-native-code-push/android/app/build.gradle edit line implementation('com.nimbusds:nimbus-jose-jwt:5.1') to implementation('com.nimbusds:nimbus-jose-jwt:5.1') { exclude group: "net.minidev", module: "json-smart" }

@azrst
Copy link

azrst commented May 10, 2022

I fixed it by changing in react-native-code-push node-module/react-native-code-push/android/app/build.gradle edit line implementation('com.nimbusds:nimbus-jose-jwt:5.1') to implementation('com.nimbusds:nimbus-jose-jwt:5.1') { exclude group: "net.minidev", module: "json-smart" }

This may make your app built successfully but It contains the potential crash. This is only used if lib duplicated but different lib versions.

thankss a lot, you saving my live :)

@sdrigues
Copy link

I fixed it by changing in react-native-code-push node-module/react-native-code-push/android/app/build.gradle edit line implementation('com.nimbusds:nimbus-jose-jwt:5.1') to implementation('com.nimbusds:nimbus-jose-jwt:5.1') { exclude group: "net.minidev", module: "json-smart" }

Works for me

@Nirav1432
Copy link

I fix by add mavenCentral Screen Shot 2022-05-09 at 12 12 38

You saved my day, THanks @congnguyen91

@ksielyov
Copy link

I fix by add mavenCentral Screen Shot 2022-05-09 at 12 12 38

Man, You saved my life! Thank you!

@trinaygangisetty
Copy link

@sdrigues can we change the code in node modules? I mean for react-native-code-push package?

@PartypayNL
Copy link

Adding mavenCentral() fixed it for us.

@myan-soft-dev-reactnative

I fixed it by changing in react-native-code-push node-module/react-native-code-push/android/app/build.gradle edit line implementation('com.nimbusds:nimbus-jose-jwt:5.1') to implementation('com.nimbusds:nimbus-jose-jwt:5.1') { exclude group: "net.minidev", module: "json-smart" }

that work, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.