question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong version code on ABI splits, RN 0.59.9 + Gradle 5.4.1

See original GitHub issue

As 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

  1. Set app to use enableSeparateBuildPerCPUArchitecture= true and Gradle version 5.4.1
  2. Run command ./gradlew.bat bundleRelease
  3. Open the generated .aab file and check the versionCode inside manifest.xml
  4. Repeat previous steps but with Gradle version 4.2.10
  5. 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:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
lucasrocacommented, Jul 17, 2019

@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.

1reaction
smakoshcommented, Sep 14, 2019

This is really bad, now my Android version code is over 4194306…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error "Could not create task ':app:mergeDebugResources ...
Gradle was upgrading in accordance with react-native 0.59.9 changelog: "future-proof" RN 59 from crashes caused by upgrading Gradle (now can ...
Read more >
React Native Upgrade Helper
React Native 0.58 is the first release of 2019, it includes work for modernizing and strengthening flow types for core components and numerous...
Read more >
Upgrade to React Native 0.59 - Matt Oakes
As React Native 0.59 includes 64-bit support on Android, we need to update the code which handles the ABI split flag. This flag...
Read more >
How to Upgrade from React Native 0.57 to 0.59 | Part 2
Though we're no longer specifying the version, we still need to update Gradle to 5.4.1. Open up android/gradle/wrapper/gradle-wrapper.properties ...
Read more >
task :react-native-reanimated:compiledebugjavawithjavac failed
React Native Reanimated error: Execution failed for task ... targetSdkVersion versionCode 30 versionName "2.1.2" // multiDexEnabled true } splits { abi ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found