android - 反应本机应用程序有效,但 APK 和 --variant=release 在加载时反复崩溃
问题描述
运行 logcat 后。我发现了以下错误异常:
AndroidRuntime: java.lang.RuntimeException: Unable to load script from assets 'index.android.bundle'. Make sure your bundle is packaged correctly or you're running a packager server.
创建 apk/运行变体发布版本不会自动包含捆绑器吗?如何重建并验证捆绑程序是否已包含在 apk/variant 版本中?
我尝试添加bundleAssetName: "index.android.bundle",
到
project.ext.react = [
entryFile: "index.js",
bundleAssetName: "index.android.bundle",
]
我仍然遇到同样的问题(反复崩溃)。我搜索了“异常”并发现了这个错误:
java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@b60a260 does not exist
解决方案
为了确保打包程序包含在 apk 中,这是必需的
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
无耻地取自这篇文章。
推荐阅读
- python - python - 如何使用numpy而不是pandas加速python中的高维循环?
- python - 为什么在熊猫中加载 csv 文件时将列转换为日期时间对象时出现错误?
- python - 如何在 django 频道中设置连接超时?
- python - AttributeError: 'NoneType' 对象没有属性 'text' BeautifulSoup 解析
- android - 应用程序崩溃与 void androidx.appcompat.widget.ContentFrameLayout.setId(int) 在 Android Studio
- reactjs - React JS 作为 HTML 返回
- javascript - 将 datepicker 日期转换为 JavaScript 日期
- swiftui - 使用 SceneDelegate.toView() 弹出视图
- windows - 如何从 Windows cmd 连接到 mongo shell?
- python - 根据历史数据买楼