React-Native版本构建在启动时崩溃

时间:2019-08-06 02:13:05

标签: android react-native

当我构建APK(在Windows 10上)时,我总是使用命令gradlew clean,然后使用gradlew assembleRelease。由于某些原因,当我使用命令adb install app\build\outputs\apk\release\app-release.apk在设备上安装发行版时,应用程序在启动时崩溃。我已经使用adb logcat *:E检查了日志,可以看到崩溃信息:

08-06 10:07:57.421 18785 18864 E AndroidRuntime: 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.
08-06 10:07:57.421 18785 18864 E AndroidRuntime:        at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
08-06 10:07:57.421 18785 18864 E AndroidRuntime:        at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:218)
08-06 10:07:57.421 18785 18864 E AndroidRuntime:        at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:31)
08-06 10:07:57.421 18785 18864 E AndroidRuntime:        at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:247)
08-06 10:07:57.421 18785 18864 E AndroidRuntime:        at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1152)
08-06 10:07:57.421 18785 18864 E AndroidRuntime:        at com.facebook.react.ReactInstanceManager.access$900(ReactInstanceManager.java:123)
08-06 10:07:57.421 18785 18864 E AndroidRuntime:        at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:943)
08-06 10:07:57.421 18785 18864 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:764)
08-06 10:07:57.453  4115  4358 E BoostFramework: Exception java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[])' on a null object reference
08-06 10:07:57.558  4115 17978 E ActivityTrigger: activityResumeTrigger: not whiteListedcom.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity/401
08-06 10:07:59.044  4115  4618 E InputDispatcher: channel 'e1bb146 com.myapp.mobileapp/com.myapp.mobileapp.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!

我的密钥库文件位于android/app内,并且在gradle.properties上具有正确的配置(密钥库的文件名和密码)。

更新:我已按照https://medium.com/@impaachu/react-native-android-release-build-crash-on-device-14f2c9eacf18

中的说明进行操作

0 个答案:

没有答案