我正在尝试第一次在我的设备(Android 4.2.2)上运行我的第一个 React Native 项目。
我得到:
unable to load script from assets index.android.bundle
cd (project directory)
react-native start
react-native run-android
我在关注 React Native tutorial 时遇到了同样的问题(在 Linux 上开发并针对 Android)。
这个issue帮助我通过以下步骤解决问题。
mkdir android/app/src/main/assets
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
react-native run-android
scripts
中自动执行上述步骤。 package.json
的一部分像这样:"android-linux": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res && react-native run-android"
npm run android-linux
每次从你的命令行。
关于android - 无法从 Windows 上的 Assets index.android.bundle 加载脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44446523/
欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://jike.in/) | Powered by Discuz! X3.4 |