欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

React-Native搭建报错:index.android.bundle is packaged correctly for release

程序员文章站 2022-07-02 21:49:45
...

React-Native搭建启动后报错:

Unable to load script.Make sure you're either running a metro server(run 'react-native start' ) or that your bundle 'index.android.bundle' is packaged correctly for release.

React-Native搭建报错:index.android.bundle is packaged correctly for release

原因是:

在根目录android/app/src/main/assets/index.android.bundle没有找到index.android.bundle这个文件

解决方案:

在根目录android/app/src/main/下新建assets文件夹
然后再根目录运行:

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