我正在使用 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/