skip to Main Content

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.

4

Answers


  1. Chosen as BEST ANSWER

    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.


  2. jcenter is down so until it comes online a temporary solution is just to disconnect from the internet and build your project, once the build is complete and the app launches you can connect back.

    Login or Signup to reply.
  3. The problem comes from the shutdown of jcenter. Event if you remove the repository for your app, you’ll get errors if some of your declare jcenter().

    The best way would be to have PRs merged and version update of those dependencies, but that might take a while.

    In the meantime you can add the following in your android/build.gradle :

    allprojects {
        repositories {
            all { ArtifactRepository repo ->
                if (repo instanceof MavenArtifactRepository) {
                    if (repo.url.toString().startsWith('https://jcenter.bintray.com/')) {
                        remove repo
                        add(mavenCentral())
                    }
                }
            }
    ...
    

    This fixed all my builds.

    Login or Signup to reply.
  4. The solution from @PhilippeAuriach is fixing it for react-native !
    I Added this :

    allprojects {
    repositories {
        all { ArtifactRepository repo ->
            if (repo instanceof MavenArtifactRepository) {
                if (repo.url.toString().startsWith('https://jcenter.bintray.com/')) {
                    remove repo
                    add(mavenCentral())
                }
            }
        }
    

    To my android/build.gradle and worked fine after hours of research !
    (Thanks @PhilippeAuriach)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search