react-native: 502 Bad Gateway: Unable to load Maven meta-data from Bintray

Description

Getting such an error, while building the app in release mode:

> Failed to list versions for com.facebook.react:react-native.
         > Unable to load Maven meta-data from https://cardinalcommerce.bintray.com/android/com/facebook/react/react-native/maven-metadata.xml.
            > Could not get resource 'https://cardinalcommerce.bintray.com/android/com/facebook/react/react-native/maven-metadata.xml'.
               > Could not GET 'https://cardinalcommerce.bintray.com/android/com/facebook/react/react-native/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

build.gradle

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
        supportLibVersion = "28.0.0"
        googlePlayServicesVersion = "11.0.0"
        googlePlayServicesLocationVersion = "17.0.0"
        appCompatVersion = "1.1.0"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.2.1")
        classpath("com.google.gms:google-services:4.3.10")
    }
}

allprojects {
    repositories {
        mavenCentral()
        mavenLocal()
        maven { url("$rootDir/../node_modules/react-native/android") }
        maven { url("$rootDir/../node_modules/jsc-android/dist") }
        maven { url "https://plugins.gradle.org/m2/" }
        maven { url "https://repo.spring.io/plugins-release/" }
        google()
        maven { url 'https://www.jitpack.io' }
        flatDir {
            dirs "$rootProject.projectDir/libs"
        }

        maven {
            url "$rootDir/../node_modules/@notifee/react-native/android/libs"
        }

        maven {
            url "https://cardinalcommerceprod.jfrog.io/artifactory/android"
            credentials {
                username 'braintree_team_sdk'
                password 'AKCp8jQcoDy2hxSWhDAUQKXLDPDx6NYRkqrgFLRc3qDrayg6rrCbJpsKKyMwaykVL8FWusJpp'
            }
        }
    }
}

The problem appeared without any code changes. Bintray status is major outage: https://isdown.app/integrations/bintray

Please advise, which steps do I need to perform, so I can successfully create release builds.

Version

0.65.0

Output of react-native info

System:
    OS: macOS 12.0
    CPU: (10) arm64 Apple M1 Pro
    Memory: 114.16 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: Not Found
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
    Watchman: 2021.11.15.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0
    Android SDK:
      API Levels: 28, 29, 30, 31
      Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3, 31.0.0
      System Images: android-31 | Google APIs ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7784292
    Xcode: 13.1/13A1030d - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_292 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.65.0 => 0.65.0 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

./gradlew assembleRelease

Snack, code example, screenshot, or link to a repository

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 19 (5 by maintainers)

Most upvoted comments

In case you are debugging similar error for your app (bintray is down again), and upgrading to 0.65+ is not an option for some reason, you can try and force dependencies manually:

  • Replace all usages of jcenter() with mavenCentral().
  • In case an old version of some dependency is not on mavenCentral, add a new block in your build.gradle, forcing newer versions of dependencies. You can find which dependencies are available in what repository with this search. Here’s the example for dependencies unavailable in 0.64.3:
allprojects {
    repositories {
        ...
        mavenCentral()

        configurations.all {
            resolutionStrategy {

                // versions used by 0.67
                force 'com.squareup.okhttp3:okhttp:3.11.0'
                force 'com.facebook.yoga:proguard-annotations:1.19.0'
                force 'com.facebook.fbjni:fbjni-java-only:0.2.2'
                force 'com.facebook.flipper:flipper:0.99.0'
                force 'com.facebook.flipper:flipper-network-plugin:0.99.0'
                force 'com.facebook.flipper:flipper-fresco-plugin:0.99.0'
            }
        }

    }
}

In case you are debugging similar error for your app (bintray is down again), and upgrading to 0.65+ is not an option for some reason, you can try and force dependencies manually:

  • Replace all usages of jcenter() with mavenCentral().
  • In case an old version of some dependency is not on mavenCentral, add a new block in your build.gradle, forcing newer versions of dependencies. You can find which dependencies are available in what repository with this search. Here’s the example for dependencies unavailable in 0.64.3:
allprojects {
    repositories {
        ...
        mavenCentral()

        configurations.all {
            resolutionStrategy {

                // versions used by 0.67
                force 'com.squareup.okhttp3:okhttp:3.11.0'
                force 'com.facebook.yoga:proguard-annotations:1.19.0'
                force 'com.facebook.fbjni:fbjni-java-only:0.2.2'
                force 'com.facebook.flipper:flipper:0.99.0'
                force 'com.facebook.flipper:flipper-network-plugin:0.99.0'
                force 'com.facebook.flipper:flipper-fresco-plugin:0.99.0'
            }
        }

    }
}

i just added mavenCentral() with jcenter() and it worked for me

@cortinico - if I’m not mistaken, you are a Meta employee – would you be able to reach out to those teams to ask them to follow up on this? there are existing issues on those repositories already that are ~6 months old:

https://github.com/facebookincubator/fbjni/issues/65 https://github.com/facebook/yoga/issues/1065

@cortinico - would it be possible to publish older versions of related packages to maven central? the following dependency versions are missing from maven central and so react-native@64 apps won’t build if jcenter is unavailable:

com.facebook.yoga:proguard-annotations:1.14.1
com.facebook.fbjni:fbjni-java-only:0.0.3
com.facebook.flipper:flipper:0.54.0
com.facebook.flipper:flipper-network-plugin:0.54.0
com.facebook.flipper:flipper-fresco-plugin:0.54.0

it appears that any dependency on jcenter was resolved in 65+ however.

worked for me by adding mavenCentral() call right before each jcenter()

@areebshakeel @cristiandan You made my day, bro!

worked for me replacing jcenter() to mavenCentral()

I found a solution that worked for us.

I replaced all the instances where it shows + in the implementation with the actual version.

If you run ./gradlew app:dependencies in the android folder, it will display which version is being used in the project. So after running the command you can do the following:

  1. If the + happens internally, then just replace it with the actual version
  2. If the + happens in a dependency, you can use resolutionStrategy in android/build.gradle such as:
allprojects {
  repositories {
    mavenLocal()
    google()
    mavenCentral()
    .... other repos

    configurations.all {
      resolutionStrategy {
        force 'com.squareup.okhttp3:okhttp:3.11.0'
        force 'com.facebook.react:react-native:0.66.1'
        force 'com.facebook.android:facebook-android-sdk:8.2.0'
      }
    }
  }
}

Also, because jscFlavor was using +, I had to add this in android/app/build.gradle: def jscFlavor = 'org.webkit:android-jsc:r250230'

Hopefully, once react-native is on mavenCentral, we can remove the version lock.