Understanding Android APK and reducing size [Part 2]

Publishing multiple APKs on Google play

In part 1, we talked about how to break your app’s native code into parts to optimize size, but now the question:

Link to part 1 of this series is here.

How do I publish them on Google Play?

Step 1: Add this to your build.gradle (app level )

what did we just do?

This code assigns different version codes to different APKs generated by our APK split configuration. The mapping numbers in line #5 are customisable but should be in the same order, i.e mapping for x86_64 must be always higher than for x86, similarly x86 should be higher than ARM, because when we publish APKs on Google Play, some devices are eligible to run multiple APKs, e.g.- Intel devices can run ARM code but will suffer performance issues as the code is not optimised for them. But in such cases Google Play provides device, the APK with higher version code, so in our example, if the initial version code was 1, the generated codes will be:

  • armeabi -> 3001
  • armeabi-v7a -> 4001
  • arm64-v8a -> 5001
  • mips -> 6001
  • x86 -> 7001
  • x86_64 -> 8001

Here in above example, in the case of conflict between ARM and x86 device, x86 will be preferred by Google Play, as it has higher version code. Awesome, right?

Split APKs

Now we have 6 APKs, each for different ABI, waiting to be published to Google Play. Lets g0!

Step 2: Enable advanced mode in Google Play console.

Navigate to the “APK” section of your app and hit “Switch to advanced mode” in the top right.

Enabling advanced mode in the developer console.

You’ll notice the “upload new APK to production” button moving down and extra actions coming up on screen.

Step 3: Upload your APKs

Yes, now in advanced mode the console accepts multiple APKs on the same track, just hit the “upload new APK” button and follow the process one by one as in simple mode and click “save draft”.The console will show a relatively less number of compatible devices but don’t worry, because it shows devices compatible to only that specific ABI.

uploading arm 64 apk

Now all “active” APKs will be having same version name but different version codes (according to their priority). The console will look something like this:

Multi APK setup on Google Play.

Make sure status of all active APKs is in production, if not move them to production by hitting the button on the right of each APK. After completing the setup, verify the process by checking the production tab, It should look like this:

Hit submit update and grab yourself a cup of coffee. Wait for a couple of hours for update to go live and relax. You have done a favor to the environment, your app and most importantly, your users.


In my case, the final app download size was reduced from 9 MB to 5 MB. The difference may vary based on the number of splits and size of native libraries used in your app.

For more about programming, follow Mindorks , so you’ll get notified when we write new posts.

Check out all the Mindorks best articles here.