当前位置: 代码迷 >> 综合 >> react native unable to load script from sets “index.android.bundle“.make sure your bundle is packag
  详细解决方案

react native unable to load script from sets “index.android.bundle“.make sure your bundle is packag

热度:87   发布时间:2023-10-24 23:08:38.0

unable to load script from sets “index.android.bundle”.make sure your bundle is packaged correctly or you’re running a package server

在这里插入图片描述

react-native run-android执行虚拟机红屏

提示:unable to load script from assets’index.android.bundle’.Make sure
your bundle is packaged correctly or your’re running apackager server.

看提示是无法加载资源文件中的script文件,解决办法就是去项目中的android->app->src->main文件夹中新建一个assets文件

然后在项目根目录运行如下代码:

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/

以上是网上的资料,

其实新版的react-native在根目录下面还缺少一个文件,就是index.android.js文件

解决:复制index.js,更新名字为index.android.js

https://blog.csdn.net/chenrongchun89/article/details/79159104

  相关解决方案