按照文档中提到的以下命令,我正在尝试为android生成签名的APK,并获得以下错误
Scanning folders for symlinks in D:ReactNativeProjAppnode_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:ReactNativeProjAppandroidappbuildintermediatesassetsreleaseindex.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()
使用以下命令:
yourCurrentProjectDirectory> react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
然后:
cd android/ && ./gradlew assembleRelease
现在您的签名APK已构建;您可以在任何Android设备上部署
adb install app/build/outputs/apk/app-release.apk
首先:
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