这个问题有点流行,但是我看不到适合我的可用解决方案,
运行此命令,对我不起作用
react-native bundle --entry-file index.android.js --bundle-output index.android.bundle
这是问题的截图
我的 react 原生版本是:0.58.5
build.gradle 中的一些重要配置(在项目级别)
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 27
supportLibVersion = "28.0.0"
}
如果您需要更多信息,请告诉我
最佳答案
android/app/src/main/assets
如果文件夹 assets 不存在,则创建 assets 目录那里。
index.android.bundle
和index.android.bundle.meta
cd android &&
./gradlew clean
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
index.js
文件,替换它们并运行它们两次。//index.android.js 和 index.ios.jsindex
.js => index.android.js
或 index.ios.js
关于android - 无法从真实设备上的 Assets 'index.android.bundle' 加载脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57300486/