Wrong version code on ABI splits, RN 0.59.9 + Gradle 5.4.1
See original GitHub issueAs mentioned in RN version 0.59.9 changelog, one should be able to upgrade to Gradle 5.4.1 & Android Gradle plugin to 3.4.0. This works and builds just fine, but I noticed that when I switch between Gradle 4.10.2 and 5.4.1, then the versionCode for my app bundle changes to a different (lower) number (I have enableSeparateBuildPerCPUArchitecture set to true). This is an issue because I have already published versions of the app which build with a higher number so Google does not allow me to use these new builds. This only happens when using Gradle 5.4.1 and changes to the “correct” build number when I switch back to the older version.
I did some testing and (afaik) the issue appears to be on the order that the ABI variants are processed. So with version 4.10.2, the last ABI to get evaluated in the “each” loop (app/build.gradle) is “x86_64”, which would return number 4 from versionCodes.get(abi)
and so the versionCodeOverride would end up being: 4 * 1048576 + versionCode.
When using Gradle 5.4.1, then I get a final: 3 * 1048576 + versionCode, implying that the last ABI to get evaluated was “arm64-v8a” (number 3) even if all 4 default ABIs are enabled and in the same order.
I don’t know much about Gradle and build scripts so maybe I’m missing something, but it seemed strange enough for me to open an issue.
React Native version: 0.59.9 React Native Environment Info: System: OS: Windows 10 CPU: (4) x64 Intel® Core™ i5-4590 CPU @ 3.30GHz Memory: 9.07 GB / 15.87 GB Binaries: Yarn: 1.16.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD IDEs: Android Studio: Version 3.4.0.0 AI-183.6156.11.34.5522156
Steps To Reproduce
- Set app to use enableSeparateBuildPerCPUArchitecture= true and Gradle version 5.4.1
- Run command ./gradlew.bat bundleRelease
- Open the generated .aab file and check the versionCode inside manifest.xml
- Repeat previous steps but with Gradle version 4.2.10
- versionCode should differ from the one found in step 3
Describe what you expected to happen:
versionCode should be the same for builds in steps 3 and 4
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:7 (1 by maintainers)
@rosskhanas I turned off enableSeparateBuildPerCPUArchitecture and manually replaced my versionCode with the latest in Play Store + 1, 4194334 + 1 in your case. Then just increment it with every build. I don’t know if there’s a fancier way of doing it.
This is really bad, now my Android version code is over 4194306…