'Unable to load Maven meta-data from https://jcenter.bintray.com/org/webkit/android-jsc/maven-metadata.xml Issue in react native

FAILURE: Build failed with an exception.

  • What went wrong: Could not determine the dependencies of task ':app:lintVitalRelease'.

Could not resolve all artifacts for configuration ':app:debugRuntimeClasspath'. Could not resolve org.webkit:android-jsc:+. Required by: project :app > Failed to list versions for org.webkit:android-jsc. > Unable to load Maven meta-data from https://jcenter.bintray.com/org/webkit/android-jsc/maven-metadata.xml. > Could not HEAD 'https://jcenter.bintray.com/org/webkit/android-jsc/maven-metadata.xml'. > Read timed out



Solution 1:[1]

Make sure that you are using mavenCentral repository instead of jcenter

https://mvnrepository.com/artifact/org.webkit/android-jsc

Solution 2:[2]

JCenter is going to shutdown and now is READ-ONLY. And it is getting offline often causing issues with builds and pipelines.

In summary

You will require to update your android/build.gradle file to use mavenCentral() instead of Jcenter().

As per Gradle documentation, JCenter is a mirror of Maven Central, so all of your dependencies should be there.

JCenter is a central artifact repository, like Maven Central. Software projects use JCenter to distribute their software to other people. JCenter also serves as a mirror for Maven Central, so any dependencies available on Maven Central are also available on JCenter (but not vice versa).

A few things to consider:

  • In case it is a library (e.g node_modules/react-native-appsflyer), pointing to Jcenter, that is giving you an error... I would advise you to check the library giving you an error has updated a new version with a fix. In case so, update to the new version to get the changes.

  • In case the library doesn't have versions with the fix, if you are building in React-native using npm packages, you could potentially take advantage of patch-package library. Because there will a possibility the libraries have not yet released the update removing JCenter from build.gradle.

Applying the patch

You can apply the changes yourself using the Patch Package library. Documentation added in the end for reference.

  1. Go to node_modules/library-with-error/android/build.gradle
  2. Change jcenter() to mavenCentral()
  3. Run: npx patch-package library-with-error
  4. Git add, commit and push

Personal notes:

  • I did advise the full removal of JCenter instead of adding MavenCentral() to the top because of the shutdown and that JCenter is often getting offline and giving timeout errors.

Based on the current timeline, builds that use JCenter will be able to resolve dependencies until February 1, 2022 without changes. After that date, there are no guarantees that you will be able to build your software if you continue to use JCenter."

  • Also, Gradle is discouraging the usage of JCenter.

"To discourage new projects from using JCenter, we will be removing JCenter from our samples and init templates. The new default will be Maven Central. Gradle itself has no inherent tie to JCenter or Maven Central, so you can always switch any other repository of your choice. This change will be effective with the next Gradle release – Gradle 7.0."

Useful Links

  • Add --use-yarn to patch-package command in case your project uses Yarn.
  • Documentation using Patch package.

Solution 3:[3]

enter image description here

The gradle icon is on the right.

Solution 4:[4]

Turn off your wifi and then build again.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Grzegorz Matyszczak
Solution 2
Solution 3 Roy Selim
Solution 4 Hamza Ehsan