当我生成第一个签名的APK时,我的Android APK正在运行JavaScript present.我try 过在Android Studio中清理/重建项目,我try 过android子文件夹中的./gradlew clean.你知道为什么代码没有更新吗?我已经看过this issue次了,但我自己都没有成功.

推荐答案

我删除了android/app/src/main/assets/目录中的index.android.*个文件.然后在项目根中运行

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

然后我重新生成了签名的APK,瞧!

编辑:如果您使用的是较新的项目,则可能没有index.android.js only 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

React-native相关问答推荐

@react-native-community/cli-platform-ios/native_modules' 来自哪里?

使用下拉菜单时react 本机react-native-dropdown-select-list,它会将下面的项目向下移动.如何阻止这种情况发生

变量 window在react-native 中代表什么?

react-native-firebase crashlytics 未显示在 firebase 仪表板上

你如何在生产模式下运行 react-native 应用程序?

这个 refs 在方法中变得未定义

React Native:自定义字体在 Android 和 iOS 上呈现不同

在 Docker 中使用 Fastlane 构建 iOS 应用

Fragment片段内的react-native

将图标添加到drawer抽屉react-navigation v5

使用离线包在 iOS 设备上运行 react-native 应用程序

react-native run-android 在设备上构建旧版本的代码

使用 WSL2 运行时如何将手机连接到 expo

在 React Native App 中禁用屏幕捕获/ScreenShot

react-native fetch() cookie 持久化

React Native - React Navigation导航转换

react-navigation模式高度

降级 react-native 的适当机制

React Native:文本 node 的 Auto宽度

在 React Native 中,两个等宽的按钮水平填充屏幕