Reputation: 2268
I have been maintaining an app with React Native v0.59.9 installed. Over the past month I have been able to run iOS builds but am now having issues with the Android version in debug mode. It appears the app is ignoring the Metro Bundler entirely. I run react-native run-android --variant=variantnameDebug
to install the app on a dev phone over USB.
The app builds and loads, however, upon booting it is not loading from the bundler. The green loading bar overlay in the app does not appear and the bundler window in the terminal does not show any indication that the device is trying to connect to it. Furthermore, if I close the bundler on my machine and restart the app, it still boots as before. Finally, if the app encounters an error, the red crash screen does not appear and the app crashes just as a native app would. This almost feels like it is running a release build with none of the RN development components.
Another odd thing is the image assets are not loading. This caused me to try generating a debug bundle and specify the assets directly explicitly:
react-native bundle --platform android --dev true --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest assets/
No luck. Based on another suggestion, I tried adding android:usesCleartextTraffic="true"
to my manifest to no avail.
Searching the web gives many results for this common problem. I'm very familiar with this issue but this appears to be something different.
Any help is greatly appreciated.
Upvotes: 1
Views: 1723
Reputation: 197
I had the exact problem and after many hours, it turned out to be a simple line of code in my MainApplication.java
Remove the following line if you have it:
import com.facebook.react.BuildConfig;
Upvotes: 2