Error: - Received status code 502 from server: Bad Gateway in React Native Android

I am trying to install app but getting this error everytime.
I Used following commands -

  1. npm install
  2. react-native run-android
Could not HEAD ''. Received status code 502 from server: Bad Gateway

1 Like

We are having the exact same issue. No change in the code from yesterday but today getting this error when trying to build the project. When you go to the link in the error, it does indeed return a 502 -

I have found the solution follow below steps:

  1. kill terminal
  2. open project in Android Studio (Android folder location).
  3. Click on sync in logcat . Project will build successfully.
  4. Run the project on emulator / real device.
  5. react-native start
  6. Reload the App .

Issue will be resolved. :grinning: :smiley:

What worked for me:

In Android/build.gradle make these changes :

  1. under allprojects->repositories, remove mavenLocal() if you have it and add mavenCentral(), also remove if you have it:
    maven {
    url “

  2. I updated my @okta/okta-react-native to v 2.2.0 as well.

After making those changes, the build worked fine.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.