Since August 2019, Google requires developers to deploy 64-bit supported Android app bundle instead of the traditional 32-bit only APK file. This requires an upgrade to the existing React-Native project in order to support 64-bit.
For the traditional method for generating APK:
cd android
./gradlew assemblyRelease
However, as doing this can only generate a 32-bit supported Android App APK only, which does not fit the Google requirement. In most of the cases, developers can just switch the building command to the following to solve the issue:
cd android
./gradlew bundleRelease
However, in some cases, this could still have an issue that the 64-bit binary is not bundled into the file. To verify if the bundle has the 64-bit binary, you can execute the following command:
# Under the root folder of React-Native proejct
zipinfo -1 android/app/build/outputs/bundle/release/app.aab | grep \.so$
This command should show you all the file path of .so files inside the bundle. If you see x86_64 as part of the path, your bundle file should be ready to deploy. If not, you should try the following method.
1. Backup the original bundle file
mv android/app/src/main/assets/index.android.bundle android/app/src/main/assets/index.android.bundle.backup
2. Regenerate the bundle file
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
3. Generate Android bundle
cd android
./gradlew bundleRelease
4. Rerun the zipinfo command to check again if x86_64 .so libraries are there.
# Under the root folder of React-Native proejct
zipinfo -1 android/app/build/outputs/bundle/release/app.aab | grep \.so$
Reference:
Handling 64-bit Android Builds for React Native – https://shift.infinite.red/handling-64-bit-android-builds-for-react-native-2fcd7a2e5c14