我试图在我的设备上第一次运行我的第一个React Native项目(Android 4.2.2)。
我得到:
无法从assets index.android.bundle中加载脚本
我使用的命令:
CD(项目目录) react-native开始 react-native运行android
我试图在我的设备上第一次运行我的第一个React Native项目(Android 4.2.2)。
我得到:
无法从assets index.android.bundle中加载脚本
我使用的命令:
CD(项目目录) react-native开始 react-native运行android
当前回答
使用npm 4.3.0版本的react-native-cli
在项目目录中,
mkdir android / app / src / main /资产 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运行android
文件名由index.android.js更改为index.js
其他回答
在Windows上
如果你确定node.js已经成功安装在你的系统上,请检查系统环境变量并在系统变量路径中添加C:\windows\system32
确保metro构建器正在运行,以使物理设备和服务器同步
首先,运行这个命令来运行metro builder
npm开始
然后你可以在react native中开始构建
react-native运行android
他们这次应该不会出错了。如果您希望您的代码在更改时重新加载。摇动你的设备,然后点击“启用Live Reload”
如果您在“开发设置”中输入了“调试服务器主机和设备端口”,请确保您删除了所输入的内容。
提出一个显而易见的建议,对我很有用。删除应用程序,重新启动服务器,重新从工具部署到设备。
我面临着这个问题,很多搜索,我解决了这个问题。
c:\ProjectFolder\ProjectName> 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:
c: \ ProjectFolder \ ProjectName > react-native运行android