无法加载脚本。请确保您正在运行Metro服务器(运行'react-native start'命令)或您的捆绑包 'index.android.bundle'。
无法加载脚本。请确保您正在运行Metro服务器(运行'react-native start'命令)或您的捆绑包 'index.android.bundle'。
在Android Studio中运行我的项目时,我遇到了这个错误,我刚刚安装了所有的东西,并一步步按照指南操作,我正在使用genymotion
作为模拟器,并从根目录下使用react-native start
,检查端口8081,关闭即时运行,这是下面链接中的一切
无法加载脚本。请确保您正在运行Metro服务器,或者您的捆绑文件“index.android.bundle”已正确打包以供发布
admin 更改状态以发布 2023年5月21日
首先确保已在根目录使用以下命令启动了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