无法从资产“index.android.bundle"加载脚本,请确保您的包已打包 [英] Unable to load script from assets 'index.android.bundle',Make sure your bundle is packaged
问题描述
我已确保捆绑程序和模拟器正在运行.
I have made sure that bundler and emulator are running.
如果我用这个推荐
react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
它可能有效,但当我在模拟器中按 rr 时不会刷新.我也试过 abd adb reverse tcp:8081 tcp:8081
的反转.什么都不适合我.
It might work but refresh won't happen when I press rr in emulator.
I have also tried reversal of abd adb reverse tcp:8081 tcp:8081
.
Nothing works for me.
推荐答案
解决 Unable to load script from assets index.android.bundle
- React Native 按照以下流程:
To resolve Unable to load script from assets index.android.bundle
- React Native follow below process :
您必须在您的android项目中手动创建目录资产或通过终端/CMD输入目录mkdir android/app/src/main/assets
You have to create dir assets manually in your android project or make Directory by Terminal/CMD enter mkdir android/app/src/main/assets
如果创建成功,则进入创建的目录
Go at the created Directory if that is successfully created then
运行第 3 步命令:
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
您的文件夹中有丢失的文件,现在您可以运行 React Native 项目 npm run android.
you have your missed files in the folder now you can Run your React Native project npm run android.
这篇关于无法从资产“index.android.bundle"加载脚本,请确保您的包已打包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!