React Native Android:通过 Android Studio 生成签名的 APK 不包含 JS Bundle

React Native Android: Generating Signed APK through Android Studio doesn't include JS Bundle

通过 Android Studio 生成签名 APK 不包含 JS 包。 我一直在努力在无法正常工作的设备上安装发布版本。最后我启用了发布版本的调试,我发现通过 android studio 生成的签名 apk 不包含 js 包。

如何生成包含 js 包的签名 apk?上传到 Play 商店。

我在 RN 文档中找到它:

Creating a release build in Android Studio You can use Android Studio to create your release builds too! It’s as easy as creating release builds of your previously-existing native Android app. There’s just one additional step, which you’ll have to do before every release build. You need to execute the following to create a React Native bundle, which’ll be included with your native Android app:

react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/com/your-company-name/app-package-name/src/main/assets/index.android.bundle --assets-dest android/com/your-company-name/app-package-name/src/main/res/

Now just create a release build of your native app from within Android Studio as usual and you should be good to go!