Search code examples
androidreact-nativeandroid-studiojcentermaven-central

react-native Could not HEAD 'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml'


I created build yesterday and it was working fine . but when I try to create the release build today I got this. some if the question that are already asked here

These question are specfic to android and new user of react-native can't understand them easily. so thats why i nam asking another question here specific for react-native users.

The question i mentioned above has answer which help in some specific cases but when it comes to react native in some cases it does nit help, like for some of the dependincies in node_modules.

The Above explination is added beacuse the question was marked as duplicate.

The build will continue, but you are strongly encouraged to update your project to use a newer Android Gradle Plugin that has been tested with compileSdk = 33

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':react-native-community_masked-view:verifyReleaseResources'.
> Could not resolve all task dependencies for configuration ':react-native-community_masked-view:releaseRuntimeClasspath'.
   > Could not resolve com.facebook.react:react-native:+.
     Required by:
         project :react-native-community_masked-view
      > Failed to list versions for com.facebook.react:react-native.
         > Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml.
            > Could not HEAD 'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml'.
               > Read timed out

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 2m 45s
5 actionable tasks: 5 up-to-date

I think the issue is due to jcenter deprecation . any possible solution or alternative of jcenter. this is specific for react-native projects where there are many dependencies and you have to change.


Solution

  • From Hours of research if finally found that. this is an issue due to jcenter is down. According to official documentation the jcenter depricated and Bintray/JCenter users should start migrating to a new hosting solution. the solution for this is to remove jcenter from build file and replace it with

    mavenCentral() // <- add it
    

    for react-native users jcenter() may be exists in some depedency that you installed recently. to check for jcenter open your project in android-studio to check all build.gradle files easliy.

    Another solution for this is that disconnect your system from internet and build your project. after you lanuc your project reconnect your system to internet.