【问题标题】:React-Native Android - Release apk "has stopped" - Looking for "index.ios"React-Native Android - 发布 apk “已停止” - 寻找 “index.ios”
【发布时间】:2017-02-23 17:25:44
【问题描述】:

我构建了一个简单的 android react-native 应用程序,当我运行 react-native run-android 时,它可以在设备上正常运行。

我已按照https://facebook.github.io/react-native/docs/signed-apk-android.html 此处的说明生成签名的 apk。

当我使用 react-native run-android --variant=release 尝试此发行版 apk 时,我得到“不幸的是,已停止”。

我如何知道发生了什么?某处有一些日志吗?

我通过谷歌找到的东西是关于调试的。但我大概不能,因为这是一个发布版本。

更新

我知道如何查看日志 - adb logcat *:S ReactNative:V ReactNativeJS:V 我得到以下内容

10-14 11:24:42.129 29039 29060 E ReactNativeJS: Requiring unknown module "./index.ios".
10-14 11:24:42.177 29039 29060 E ReactNativeJS: Module AppRegistry is not a registered callable module (calling runApplication)
10-14 11:24:42.534 29039 29060 E ReactNativeJS: Module AppRegistry is not a registered callable module (calling unmountApplicationComponentAtRootTag)

为什么我的 android 版本 apk 会寻找任何与 ios 相关的内容?是不是我配置错了?

【问题讨论】:

    标签: react-native react-native-android


    【解决方案1】:

    在回答我自己的问题时,我将其追溯到我在 GitHub 上找到的一个组件。 index.android.js 只包含:

    module.exports = require('./index.ios');

    我最终将我的应用程序剥离为最基本的内容,将其部署到手机上并进行测试。然后在重新部署之前添加更多以前损坏的内容。有点像git bisect,但更手动!

    TL;DR - 如果我在所有 .js 文件(包括 node_modules 中的文件)中搜索 index.ios,我可能已经找到了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-07
      • 1970-01-01
      • 2016-12-23
      • 2018-05-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多