React-native run-android命令通过在android模拟器中留下消息来终止。信息如下:
无法加载脚本。确保你要么运行Metro服务器,要么运行你的捆绑包index.android。Bundle '被正确地打包以便发布。
我做错了什么?
React-native run-android命令通过在android模拟器中留下消息来终止。信息如下:
无法加载脚本。确保你要么运行Metro服务器,要么运行你的捆绑包index.android。Bundle '被正确地打包以便发布。
我做错了什么?
当前回答
这种错误的可能性也是错误的路径,检查一次
export ANDROID_HOME=/Users/microrentindia/Library/Android/sdk/
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
其他回答
我也遇到过这个问题。我解决了下面这一步。
在Environment Veritable中检查android sdk路径。
添加 系统变量中的ANDROID_HOME = C:\Users\user_name\AppData\Local\Android\Sdk 而且 C:\Users\user_name\AppData\Local\Android\Sdk\platform-tools路径在“系统变量”中
替换sharedBlacklist如下代码段
var sharedBlacklist = [
/node_modules[\/\\]react[\/\\]dist[\/\\].*/,
/website\/node_modules\/.*/,
/heapCapture\/bundle\.js/,
/.*\/__tests__\/.*/
];
在node_modules / metro-config / src / / blacklist.js违约
然后执行npx react-native run-android——port 9001
编码. .快乐!
这适用于我,另外添加端口号和运行android
npx react-native run-android --port=8082 (maybe port number differs)
嘿,伙计们,两个按钮的组合解决了我的问题。这与港口有关。
adb reverse tcp:8088 tcp:8088
react-native run-android --port=8088
通过这样做,应用程序可以通过USB连接我的手机。 我认为我的AV或Vagrant或PC中的其他东西正在使用该端口。
如果需要,您可以将8088更改为其他内容。
享受吧!
这个错误突然出现在我面前,而我解决它的方法是:
Android Studio中的AVD管理器 在虚拟设备的操作下按下箭头 擦除数据 重新启动地铁
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