React native buld failed with the following message Failed to list versions for com.facebook.react:react-native

I am using ReactNative version 0.62.2 and when i try to run the application using the command

react-native run-android the build gets failed with the following error message

Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve com.facebook.react:react-native:+.
     Required by:
         project :app
         project :app > project :react-native-fs
         project :app > project :react-native-community_async-storage
         project :app > project :react-native-community_datetimepicker
         project :app > project :react-native-community_slider
         project :app > project :react-native-firebase_analytics
         project :app > project :react-native-firebase_app
         project :app > project :react-native-firebase_storage
         project :app > project :react-native-audio
         project :app > project :react-native-document-picker
         project :app > project :react-native-file-selector
         project :app > project :react-native-get-random-values
         project :app > project :react-native-image-crop-picker
         project :app > project :react-native-navigation
         project :app > project :react-native-scan-barcode
         project :app > project :react-native-track-player
         project :app > project :react-native-vector-icons
         project :app > project :react-native-video
      > Failed to list versions for com.facebook.react:react-native.
         > Unable to load Maven meta-data from http://dl.bintray.com/lukaville/maven/com/facebook/react/react-native/maven-metadata.xml.
            > Could not get resource 'http://dl.bintray.com/lukaville/maven/com/facebook/react/react-native/maven-metadata.xml'.
               > Could not GET 'http://dl.bintray.com/lukaville/maven/com/facebook/react/react-native/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

Not sure why it fails now because earlier it builds properly

Build.gradle

buildscript {
    ext {
        RNNKotlinVersion = "1.3.61"
        buildToolsVersion = "28.0.3"
        minSdkVersion = 19
        compileSdkVersion = 28
        targetSdkVersion = 28
        RNNKotlinStdlib = "kotlin-stdlib-jdk8"
    }
    repositories {
        google()
        jcenter()
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"
        classpath("com.android.tools.build:gradle:3.5.2")
        classpath 'com.google.gms:google-services:4.3.3'

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

Solution 1:

Bintray service is down and the only way to fix this is to migrate to React Native 0.65, where this repo is no longer used.

Solution 2:

Yeah, i found a working solution but not sure whether it is a good one.

Instead of bintray service i have used the following in android -> build.gradle

allprojects {
    repositories {
        mavenLocal()
        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")
        }

        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
        maven { url 'http://dl.bintray.com/lukaville/maven' }
    }
}

I have replaced the bintray to https://repo1.maven.org/maven2 like below

allprojects {
    repositories {
        mavenLocal()
        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")
        }

        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
        maven { url 'https://repo1.maven.org/maven2' }
    }
}

When i build the application the build was successful.