React-native run-android命令通过在android模拟器中留下消息来终止。信息如下:
无法加载脚本。确保你要么运行Metro服务器,要么运行你的捆绑包index.android。Bundle '被正确地打包以便发布。
我做错了什么?
React-native run-android命令通过在android模拟器中留下消息来终止。信息如下:
无法加载脚本。确保你要么运行Metro服务器,要么运行你的捆绑包index.android。Bundle '被正确地打包以便发布。
我做错了什么?
当前回答
你还没有启动捆扎机呢。在项目的根目录下运行npm start或react-native start,然后再执行react-native Run -android。
其他回答
你还没有启动捆扎机呢。在项目的根目录下运行npm start或react-native start,然后再执行react-native Run -android。
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
在重命名我的android包ID后,我在React Native v0.69中遇到了这个问题。
将/android/app/src/debug/java/old_package_name重命名为 /android/app/src/debug/java/new_package_name,我不小心将AndroidManifest.xml的调试版本移动到新创建的路径中。
在把它移回/android/app/src/debug/后,yarn android又可以正常工作了,没有做任何其他的解决方案。有趣的是,这个错误导致了这个错误,所以如果它发生在其他人身上,检查确保你的文件在他们应该在的地方。
嘿,伙计们,两个按钮的组合解决了我的问题。这与港口有关。
adb reverse tcp:8088 tcp:8088
react-native run-android --port=8088
通过这样做,应用程序可以通过USB连接我的手机。 我认为我的AV或Vagrant或PC中的其他东西正在使用该端口。
如果需要,您可以将8088更改为其他内容。
享受吧!
我确信它是这里提到的其他东西的某种组合,比如允许明文,这是我为localhost启用的。但这是谜题的最后一块。
project.ext.react = [
entryFile: "index.js",
// ADD THESE THREE
bundleAssetName: "index.android.bundle",
bundleInDebug: true,
bundleInRelease: true
]
RN: 0.61.3