[英]Release APK crash on start - React Native
我有反应原生发行APK的问题。
该应用程序在调试模式下运行,但在发布模式下立即崩溃
从logcat获得这些消息可能导致此问题
Module AppRegistry is not a registered callable module (calling unmountApplicationComponentAtRootTag)
11-01 08:28:24.531 6644 6662 E ReactNativeJS: undefined is not an object (evaluating 'd.View.propTypes.style')
11-01 08:28:24.534 6644 6662 E ReactNativeJS: Module AppRegistry is not a registered callable module (calling runApplication)
这是我的包裹:
{
"name": "jbw",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"color": "^2.0.0",
"intl": "^1.2.5",
"native-base": "^2.3.3",
"prop-types": "^15.6.0",
"react": "16.0.0-beta.5",
"react-native": "0.49.3",
"react-native-fontawesome": "^5.7.0",
"react-native-keyboard-aware-scroll-view": "^0.4.1",
"react-native-linear-gradient": "^2.3.0",
"react-native-loading-spinner-overlay": "^0.5.2",
"react-native-masked-text": "^1.6.2",
"react-native-modal": "^4.1.1",
"react-native-popup-dialog": "^0.9.38",
"react-native-super-grid": "^1.0.4",
"react-native-vector-icons": "^4.4.2",
"react-navigation": "^1.0.0-beta.15"
},
"devDependencies": {
"babel-jest": "21.2.0",
"babel-preset-react-native": "4.0.0",
"jest": "21.2.1",
"react-test-renderer": "16.0.0-beta.5"
},
"jest": {
"preset": "react-native"
}
}
得到了问题,由
View.PropTypes
弃用0.49应该转移到
import { ViewPropTypes } from 'react-native';
尝试执行以下步骤:
cd android
sudo ./gradlew clean
如果不起作用,您可以index.android.js
上检查index.android.js
:
AppRegistry.registerComponent('MyAppName', () => MyRootComponent);
验证(MyAppName)中的名称是否与方法getMainComponentName()
中MainActivity.java
中的名称相同
只要确保你有:
"react-native": "0.50.3",
"react": "^16.0.0"
然后做:
watchman watch-del-all
cd android
./gradlew clean
./gradlew assembleDebug
一切都会好起来的
信用:@mobdim https://github.com/facebook/react-native/issues/16745#issuecomment-343443988
我应该提一下,我必须解决Ganesh Cauda提到的问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.