【问题标题】:Release APK crash on start - React Native发布 APK 在启动时崩溃 - React Native
【发布时间】:2017-10-31 10:35:15
【问题描述】:

我对 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"
  }
}

【问题讨论】:

  • 您在哪里找到日志文件?
  • 安卓可以使用adb logcat
  • 不知道这个谢谢:)

标签: android react-native apk


【解决方案1】:

得到问题,由

引起
View.PropTypes 

在 0.49 已弃用 应该移到

import { ViewPropTypes } from 'react-native';

【讨论】:

  • 没问题,看来会出现更多与本次更新相关的问题
  • 我们必须在哪个文件上添加它?
【解决方案2】:

尝试执行以下步骤:

  1. cd android
  2. sudo ./gradlew clean

如果不行,可以在线查看index.android.js

AppRegistry.registerComponent('MyAppName', () => MyRootComponent);

验证 (MyAppName) 中的名称是否与方法 getMainComponentName()MainActivity.java 中的名称相同

【讨论】:

  • 你好,谢谢你的建议,我已经试过了,我的项目中的所有文件都已经正确,它在调试版本中运行良好,问题只出现在发布版本上,有什么想法吗?跨度>
【解决方案3】:

只要确保你有:

"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 提到的问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-05-16
    • 2021-04-05
    • 2021-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-06
    相关资源
    最近更新 更多