java.lang.RuntimeException: Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle

时间:2019-05-19 04:03:17

标签: android react-native

I am somewhat new to react-native and Android Studio (I am working on my first app). The iOS version of my app is working fine. However, I cannot say the same about my Android version. I can run the Android app from react-native and from Android Studio without any issues in the emulators. I can also push the app to my Android tablet via Android Studio, and the app works exactly as expected. The problem comes in when I go into Android Studio and build my APK. The release APS builds fine. However, when I push it to the Google Play store (to a closed test), in Pre-launch report, all devices report the following error:

"Issue: java.lang.RuntimeException: Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release."

The launch page loads and then the app immediately closes. I have pulled the app to my Android tablet from the Google Play Store from my closed test, and I am seeing the same results from the APK.

2 days ago, I was able to upload a version of my app to my closed test, and that version was working. I got an update pushed to me for Android Studio, and I have not been able to push a good APK to Google Play Store since.

I am completely lost, as I have tried everything that I can find on the web...and nothing seems to work. Since I cannot reproduce the error locally, what is the best way to troubleshoot this. Does anyone have any idea as to what could be causing this error?

1 个答案:

答案 0 :(得分:0)

此错误用于调试模式。您必须在生成签名的APK后使用发布模式。请按照the official react native doc构建已签名的APK。