'Could not HEAD 'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
I am trying to build my react-native project for android and getting the following error on Windows but its working on Mac.
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1090 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Installing the app...
> Task :react-native-get-sms-android:generateDebugRFile FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
128 actionable tasks: 128 executed
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-get-sms-android:generateDebugRFile'.
> Could not resolve all files for configuration ':react-native-get-sms-android:debugCompileClasspath'.
> Could not resolve com.facebook.react:react-native:+.
Required by:
project :react-native-get-sms-android
> 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'. Received status code 502 from server: Bad Gateway
* 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
BUILD FAILED in 24s
My Environment:
- Windows 10 Home
- React Native v66.4
- NodeJS v12.18.1
Found solutions when googled about this error that bintray was down and its status could be tracked at https://status.bintray.com.
But building the project works fine on Mac environment, and at the same time, it is failing in Windows with Received status code 502 from server: Bad Gateway
. Any clues on this weird behavior?
Solution 1:[1]
Solution 2:[2]
If Osvaldo's solution doesn't work, another one is to update your dependency itself which relies on jcenter in its gradle at the current version.
In this case, it's react-native-get-sms-android
. Updating it may free it from jcenter.
In my case, it was an old version of react-native-sqlite-2
.
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 | |
Solution 2 | Yairopro |