我正在尝试准备发布我的应用,但是当我从应用商店运行adb install android/app/app-release.apk
或下载我的Beta版本时,它会抱怨Unfortunately App, has stopped
我跑了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)
这是因为我的发布版本试图在调试模式下运行吗?我认为如果它仍然试图寻找localhost:8081,它只会显示错误。
答案 0 :(得分:4)
看起来我必须首先运行cd android && ./gradlew assembleRelease
注意:
发布android构建1)cd android && ./gradlew assembleRelease
2)构建>生成已签名的APK 3)连接您的手机4)运行adb install android/app/app-release.apk
以测试版本构建在设备上运行5)运行adb logcat
以查看日志以防万一发生任何事情