React Native and 64bit Android New Google Play rules. How to Solve?

Starting from August 1, 2019 Google Play will accept only 64-bit version of the application, so if you are lucky and have Android application written on Java or Kotlin — you can skip this article, otherwise— read further…

You can read more here in Google Blog.

DO NOT PANIC! I will explain what you need to do.

Episode 1. Small revision for latest news.

  • Changes in 2019:

Google is trying to move all mobile applications (except games written on Unity) to 64-bit support.

If you do not perform any actions:
– your application will still be available in the Google Play Market
– all updates that not support 64-bit will be ignored

That means that you will not be able to update an application unless you will add a 64 bit support version.

  • Changes in 2021:

All application that do not support a 64-bit version will not be available in the Google Play Market (including games written on the Unity engine)

  • Exceptions:
  1. Applications that are running on Android 8 Oreo or earlier do not need 64-bit support
  2. Android TV and Wear OS do not need 64-bit support (but that’s not quite ReactNative side, duh)

Episode 2. What to do?

Thank you Facebook and ReactCommunity! As of March 12, 2019, ReactNative has a new version release 0.59.

You can read the ReactNative 0.59 release notes here.

Yes, they added hooks, but the important thing here is 64-bit support on Android.

Sooo, the first and only step that you need to do is to update you ReactNative version to 0.59.1 or higher.

Important. Update must be done to at lease 0.59.1. This is related to missing commands for your application gradle.

If it is so important for you to have 0.59, there is some information presence of witch you need to verify, and if it is missing — then just add it.

Follow the official guide for update here to upgrade ReactNative or read below.

Steps are pretty simple:

  1. Just run:
react-native upgrade <version>

2. Resolve a conflict via git and voilà! And everything is ready.

When you are done let’s walk through the thing that should be in your ReactNative project.

We need to take a look on your ABI (Application Binary Interface) manager in Android project; basically these are directives to a device of what instruction set it should use.

Take a look at the file /android/app/build.gradle, we are interested in abiblock:

android {    ...   
    splits {
        abi {
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
    }    // In case, if you're using `ndk`
    defaultConfig {
        ndk {
            // Tells Gradle to build outputs for the following ABIs and package
            // them into your APK.
            abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
    }    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) { 
                output.versionCodeOverride =
                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
    }    ...}

IMPORTANT. Insure that in include and versionCodes you have "arm64-v8a" and "x86-64".

IMPORTANT. If you’re using ndk, insure you have "arm64-v8a" and "x86-64" too.

Let’s walk through the ABI manager config to find out what’s happening there:

  • armeabi-v7a and x86 — support of instruction sets on x86 (32-bit) CPUs
  • arm64-v8a and x86-64— instruction sets for 64-bit CPUs

Thanks to these directives we are telling our application that it can run on 32 and 64-bit CPUs.

If there is something missing in you build.gradle just add it.

The important thing you need to know about multiple architecture support — it increase size of the your .apk file. No worries it have nothing to do with JS it self.

All you need to do is to bundle your Android application, it means replace your .apk with .aab .

If you followed ReactNative documentation about delivery to Google Play, most likely you used this command to build application:

./gradlew assembleRelease

You need to replace this command with:

./gradlew bundleRelease

This will create an .aab file and then you can do delivery as usual, but now you need to use App Signing by Google Play feature to sign you application and thats it.

How android bundle works you can react in official documentation here or you can read this article “Make your React Native app 3x smaller with one simple command” for more wide view.

I know that the ReactNative update can be painful, but new specifications of the Google Play Market are making us to do actualize of our projects. In the end, thanks to these changes, you will still have a good performance boost and hooks in your ReactNative project, so it is not high price to pay.