React Native运行后报错处理
在Android Studio中运行启动react-native项目时报的这个错误
如下图:
报错原因:
在项目中缺少这个文件:index.android.bundle
解决方法:
1、 项目中在android/app/src/main/创建文件夹 assets
2、在项目中执行命令
npx 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
执行后在新建的 assets 文件夹下就会生成一个index.android.bundle文件
重新运行项目即可