android - 生成 APK 后 react native 黑屏

标签 android react-native

我正在使用 react-native,并且在我开发时一切正常,但是,当我构建 APK(使用本教程:https://facebook.github.io/react-native/docs/signed-apk-android.html#content)并将其安装到我的设备上时,应用程序只显示空白页。
有人遇到同样的问题吗?

编辑:
我查看了设备上的日志,这是错误:

11-09 22:00:51.115 16525 16525 W unknown:React: You seem to be running on device. Run 'adb reverse tcp:8081 tcp:8081' to forward the debug server's port to the device.
11-09 22:00:51.115 16525 16525 W unknown:React: You seem to be running on device. Run 'adb reverse tcp:8081 tcp:8081' to forward the debug server's port to the device.
11-09 22:00:51.198 16525 16555 E ReactNative: Got JS Exception: SyntaxError: Unexpected token ':'. Parse error.

谢谢。

最佳答案

好的,我在构建之前通过运行以下命令解决了这个问题:

curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"

关于android - 生成 APK 后 react native 黑屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33617099/

相关文章:

android - 在 Android 中对 radioGroup 使用 switch-case 和 if-else 有什么区别?

javascript - 如何使用 react 选择列表?

android - React Native 任​​务 ':app:transformClassesWithDexForDebug' 执行失败

ios - 几天后 react native 应用程序无法启动

javascript - React-Native:ScrollView、refs 和自定义组件

android - findViewById错误-没有足够的信息来推断类型变量T。我复制了java代码并在线转换了它

android - 从我的网站在 Android 应用程序中安装更新

android - 为 Android 创建的新 Facebook 应用程序发布权限不起作用。使用 Facebook sdk 3.14.xx 和示例

Android - 更改高度时阴影大小不受影响

ios - 如何从 native 应用程序链接到手机设置