我有反应原生发行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"
}
}
答案 0 :(得分:4)
由
引起的问题View.PropTypes
已弃用0.49 应该转移到
import { ViewPropTypes } from 'react-native';
答案 1 :(得分:0)
尝试执行以下步骤:
cd android
sudo ./gradlew clean
如果不起作用,您可以在线上查看index.android.js
:
AppRegistry.registerComponent('MyAppName', () => MyRootComponent);
验证(MyAppName)中的名称是否与方法MainActivity.java
中的getMainComponentName()
中的名称相同
答案 2 :(得分:0)
确保您拥有:
"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提到的问题