无法加载脚本。请确保您正在运行Metro服务器(运行'react-native start'命令)或您的捆绑包 'index.android.bundle'。

12 浏览
0 Comments

无法加载脚本。请确保您正在运行Metro服务器(运行'react-native start'命令)或您的捆绑包 'index.android.bundle'。

在Android Studio中运行我的项目时,我遇到了这个错误,我刚刚安装了所有的东西,并一步步按照指南操作,我正在使用genymotion作为模拟器,并从根目录下使用react-native start,检查端口8081,关闭即时运行,这是下面链接中的一切

无法加载脚本。请确保您正在运行Metro服务器,或者您的捆绑文件“index.android.bundle”已正确打包以供发布

admin 更改状态以发布 2023年5月21日
0
0 Comments

"react-native": "0.64.1",

我解决了这个问题,通过改变android > app > build.gradleproject.ext.reactbundleInDebug: true

project.ext.react = [
bundleInDebug: true,
enableHermes: ***,  
]

0
0 Comments

首先确保已在根目录使用以下命令启动了bundler

npm start 

或者

react-native start

如果不起作用,请手动将assets文件夹添加到以下目录中:

android/app/src/main/{assets}

然后将index.android.js重命名为index.js,然后使用以下命令:

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

现在,您可以创建您的apk

react-native run-android

0