'Bad gateway when building Android React Native
When I run react-native run-android, I get the following error:
* What went wrong:
Could not determine the dependencies of task ':react-native-intercom:generateDebugRFile'.
> Could not resolve all task dependencies for configuration ':react-native-intercom:debugRuntimeClasspath'.
> Could not resolve com.facebook.react:react-native:+.
Required by:
project :react-native-intercom
> Failed to list versions for com.facebook.react:react-native.
> Unable to load Maven meta-data from https://dl.bintray.com/intercom/intercom-maven/com/facebook/react/react-native/maven-metadata.xml.
> Could not get resource 'https://dl.bintray.com/intercom/intercom-maven/com/facebook/react/react-native/maven-metadata.xml'.
> Could not GET 'https://dl.bintray.com/intercom/intercom-maven/com/facebook/react/react-native/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
I have seen similar issues others were having and they said to check the status: https://status.bintray.com/ - but it's saying everything is operational. I also grepped my whole codebase for bintray, but there is no reference to it.
Edit: Also tried that URL in the browser and get the same 502
also:
dara@dara-beast:~/DAD/rn-app$ curl http://dl.bintray.com/intercom/intercom-maven/com/facebook/react/react-native/maven-metadata.xml
<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
dara@dara-beast:~/DAD/rn-app$ curl https://dl.bintray.com/
<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
Update
It seems that bintray was "sunsetted" so I'm not expecting it to come back. I've replaced jcenter() with mavenCentral() and it seemed to help, but I still get errors like the following:
* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not find com.facebook.yoga:proguard-annotations:1.14.1.
Searched in the following locations:
- file:/home/dara/.m2/repository/com/facebook/yoga/proguard-annotations/1.14.1/proguard-annotations-1.14.1.pom
- file:/home/dara/DAD/rn-app/node_modules/react-native/android/com/facebook/yoga/proguard-annotations/1.14.1/proguard-annotations-1.14.1.pom
- file:/home/dara/DAD/rn-app/node_modules/jsc-android/dist/com/facebook/yoga/proguard-annotations/1.14.1/proguard-annotations-1.14.1.pom
- https://dl.google.com/dl/android/maven2/com/facebook/yoga/proguard-annotations/1.14.1/proguard-annotations-1.14.1.pom
- https://repo.maven.apache.org/maven2/com/facebook/yoga/proguard-annotations/1.14.1/proguard-annotations-1.14.1.pom
- https://www.jitpack.io/com/facebook/yoga/proguard-annotations/1.14.1/proguard-annotations-1.14.1.pom
- https://maven.google.com/com/facebook/yoga/proguard-annotations/1.14.1/proguard-annotations-1.14.1.pom
- https://sdk.squareup.com/public/android/com/facebook/yoga/proguard-annotations/1.14.1/proguard-annotations-1.14.1.pom
Required by:
project :app > com.facebook.react:react-native:0.63.4
> Could not find com.facebook.fbjni:fbjni-java-only:0.0.3.
Searched in the following locations:
- file:/home/dara/.m2/repository/com/facebook/fbjni/fbjni-java-only/0.0.3/fbjni-java-only-0.0.3.pom
- file:/home/dara/DAD/rn-app/node_modules/react-native/android/com/facebook/fbjni/fbjni-java-only/0.0.3/fbjni-java-only-0.0.3.pom
- file:/home/dara/DAD/rn-app/node_modules/jsc-android/dist/com/facebook/fbjni/fbjni-java-only/0.0.3/fbjni-java-only-0.0.3.pom
- https://dl.google.com/dl/android/maven2/com/facebook/fbjni/fbjni-java-only/0.0.3/fbjni-java-only-0.0.3.pom
- https://repo.maven.apache.org/maven2/com/facebook/fbjni/fbjni-java-only/0.0.3/fbjni-java-only-0.0.3.pom
- https://www.jitpack.io/com/facebook/fbjni/fbjni-java-only/0.0.3/fbjni-java-only-0.0.3.pom
- https://maven.google.com/com/facebook/fbjni/fbjni-java-only/0.0.3/fbjni-java-only-0.0.3.pom
- https://sdk.squareup.com/public/android/com/facebook/fbjni/fbjni-java-only/0.0.3/fbjni-java-only-0.0.3.pom
Required by:
project :app > com.facebook.react:react-native:0.63.4
I tried to exclude yoga and others in the build file but it doesn't work. I have no idea what to do.
Solution 1:[1]
It works now.
I reset my hours of changes to master and it works. Leaving this here for future people who have this error - don't trust the bintray status page, just wait. I read somewhere during my research that it will stay up indefinitely read only.
Solution 2:[2]
I wouldn't recommend depending on JCenter, it has been unstable these past few weeks.
There's an official library from Intercom for React-Native now! It's using the new mavenCentral repo, and there's very little differences (that I found) between this and react-native-intercom. The methods are the same. You might want to migrate to it.
Solution 3:[3]
I'm having this issue now that jcenter has sunset what seems like 2 months early. https://status.bintray.com/
Help to resolve this would be great. Adding mavenCentral() has not helped, upgrading gradle to v6.9 & React Native versions to 0.65.0. has not helped either.
I still get the error:
> Failed to list versions for com.facebook.react:react-native.
> Unable to load Maven meta-data from https://google.bintray.com/flexbox-layout/com/facebook/react/react-native/maven-metadata.xml.
> Could not get resource 'https://google.bintray.com/flexbox-layout/com/facebook/react/react-native/maven-metadata.xml'.
> Could not GET 'https://google.bintray.com/flexbox-layout/com/facebook/react/react-native/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
Solution 4:[4]
I using new maven, it woking for me
File :
./android/build.gradle
changer to:
maven { url 'https://repo1.maven.org/maven2/' }
Solution 5:[5]
- Swtich On
Toggle Offline Mode(check the above image link!) in Gradle Window
- You can open Gradle Window by clicking Gradle button in the right side bar.
Build > Clean ProjectandFile > Invalidate Caches > (check) Clear file system cache and Local History > Invalidate and RestartFile > Sync Project with Gradle Files
It works after these things.
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 | Dara Java |
| Solution 2 | Nishant Nair |
| Solution 3 | Petetheodddog |
| Solution 4 | Tr?n Hi?p |
| Solution 5 | Seongjun Kim |
