简体   繁体   English

React Native + Android:发布版本“无法获取BatchedBridge”吗?

[英]React Native + Android: Release build “Could not get BatchedBridge”?

I'm trying to prepare my app for release, but when I run adb install android/app/app-release.apk or download my Beta build from the app store, it complains about with Unfortunately App, has stopped 我正在尝试准备发布我的应用,但是当我运行adb install android/app/app-release.apk或从应用商店下载我的Beta版本时,它抱怨Unfortunately App, has stopped

I ran adb logcat and I see this: 我运行了adb logcat ,我看到了:

01-13 22:46:03.949 13326 13351 E         : Unable to load script from assets: index.android.bundle
01-13 22:46:03.954 13326 13371 E AndroidRuntime: FATAL EXCEPTION: mqt_js
01-13 22:46:03.954 13326 13371 E AndroidRuntime: Process: com.potatolabs.banana, PID: 13326
01-13 22:46:03.954 13326 13371 E AndroidRuntime: java.lang.RuntimeException: com.facebook.react.devsupport.JSException: Could not get BatchedBridge, make sure your bundle is packaged correctly
01-13 22:46:03.954 13326 13371 E AndroidRuntime:        at com.facebook.react.bridge.DefaultNativeModuleCallExceptionHandler.handleException(DefaultNativeModuleCallExceptionHandler.java:24)
01-13 22:46:03.954 13326 13371 E AndroidRuntime:        at com.facebook.react.devsupport.DisabledDevSupportManager.handleException(DisabledDevSupportManager.java:158)

Is this because my release build is trying to run in debug mode?? 这是因为我的发行版本试图以调试模式运行吗? I thought it would only show that error if it's still trying to look for localhost:8081. 我认为,如果它仍在尝试查找localhost:8081,则只会显示该错误。

Looks like I had to run cd android && ./gradlew assembleRelease first 看起来我不得不运行cd android && ./gradlew assembleRelease

Notes: releasing android builds 1) cd android && ./gradlew assembleRelease 2) build > generate signed APK 3) connect your phone 4) run adb install android/app/app-release.apk to test that the release build works on a device 5) run adb logcat to view the log in case anything is broken 注意:发布android版本1) cd android && ./gradlew assembleRelease 2)构建>生成签名的APK 3)连接手机4)运行adb install android/app/app-release.apk以测试发布版本在设备上是否有效5)运行adb logcat以查看日志,以防万一发生任何问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM