React-native run-android命令通过在android模拟器中留下消息来终止。信息如下:
无法加载脚本。确保你要么运行Metro服务器,要么运行你的捆绑包index.android。Bundle '被正确地打包以便发布。
我做错了什么?
React-native run-android命令通过在android模拟器中留下消息来终止。信息如下:
无法加载脚本。确保你要么运行Metro服务器,要么运行你的捆绑包index.android。Bundle '被正确地打包以便发布。
我做错了什么?
当前回答
this works for me on ubuntu
1. if you are having node version 17 first downgrade its version:-
You can use n for node's version management.
this is very easy to use.
$ npm install -g n
then you can show your node version:
$ node -v
v16.13.2
2. create an assets folder inside root of the project:-
project\android\app\src\main\assets
set folder name should be assets
3. now the final step implement the given code inside the project folder:-
$cd project
/project$ 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
4. after following all these step react-native was successfully running on my pc
其他回答
对我有效的解决方案如下:
var sharedBlacklist = [
/node_modules[\/\\]react[\/\\]dist[\/\\].*/,
/website\/node_modules\/.*/,
/heapCapture\/bundle\.js/,
/.*\/__tests__\/.*/
];
在我的例子中,模拟器的Wifi和移动数据是关闭的。
我也有同样的问题。但是这个方法解决了这个问题。 进入android文件夹使用 CD android然后gradlew clean或。/gradlew clean,以适用于你的操作系统的为准。
模拟器上的错误信息有点误导人。我用的是Macbook。我需要通过运行$ chmod 755 ./gradlew来更改android/gradlew的权限,然后可以构建应用程序并将其部署到android模拟器。
这也可能是由于在清单中禁用INTERNET权限造成的。我有一个不需要/使用任何互联网的应用程序,我已经删除了它。自从我更新这个应用程序已经有一段时间了,我已经完全忘记了它。花了大约一个小时把每个答案都试了一遍。