无法使用react native生成带符号的apk

时间:2017-11-23 07:15:30

标签: react-native react-native-android

按照文档中提到的命令,我正在尝试为Android生成签名的apk并收到以下错误

Scanning folders for symlinks in D:\ReactNativeProj\App\node_modules (23ms
) Building 88% > :app:bundleReleaseJsAndAssets
Loading dependency graph, done.
warning: the transform cache was reset.
bundle: start
bundle: finish
bundle: Writing bundle output to: D:\ReactNativeProj\App\android\app\build\intermediates\assets\release\index.android.bundle
bundle: Copying 22 asset files
bundle: Done writing bundle output
bundle: Done copying assets

FAILURE: Build failed with an exception.

* What went wrong:
Unable to process incoming event 'ProgressComplete ' (ProgressCompleteEvent)

点击此链接进行生成制作apk

http://facebook.github.io/react-native/docs/signed-apk-android.html

通过以下命令生成构建后apk生成成功

gradlew assembleRelease --console plain

但是在安装之后apk在启动时崩溃并出现以下错误。

11-23 15:36:25.532  7135  7135 D ReactNative: ReactInstanceManager.ctor()
11-23 15:36:25.542  7135  7135 D ReactNative: ReactInstanceManager.createReactContextInBackground()
11-23 15:36:25.542  7135  7135 D ReactNative: ReactInstanceManager.recreateReactContextInBackgroundInner()
11-23 15:36:25.543  7135  7135 D ReactNative: ReactInstanceManager.recreateReactContextInBackgroundFromBundleLoader()
11-23 15:36:25.543  7135  7135 D ReactNative: ReactInstanceManager.recreateReactContextInBackground()
11-23 15:36:25.543  7135  7135 D ReactNative: ReactInstanceManager.runCreateReactContextOnNewThread()
11-23 15:36:25.677  7135  7157 D ReactNative: ReactInstanceManager.createReactContext()
11-23 15:36:25.994  7135  7157 D ReactNative: Initializing React Xplat Bridge.
11-23 15:36:26.003  7135  7157 D ReactNative: Initializing React Xplat Bridge before initializeBridge
11-23 15:36:26.022  7135  7157 D ReactNative: Initializing React Xplat Bridge after initializeBridge
11-23 15:36:26.022  7135  7157 D ReactNative: CatalystInstanceImpl.runJSBundle()
11-23 15:36:26.045  7135  7180 D ReactNative: ReactInstanceManager.setupReactContext()
11-23 15:36:26.045  7135  7180 D ReactNative: CatalystInstanceImpl.initialize()
11-23 15:36:27.113  7135  7179 E ReactNativeJS: undefined is not an object (evaluating 's.View.propTypes.style')
11-23 15:36:25.532  7135  7135 D ReactNative: ReactInstanceManager.ctor()

1 个答案:

答案 0 :(得分:0)

第一:

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

最终构建:

./gradlew assembleRelease -x bundleReleaseJsAndAssets