How the 64-bit requirement decreased my app size

Starting August 1, 2019, your apps published on Google Play will need to support 64-bit architectures. 64-bit CPUs deliver faster, richer experiences for your users. Adding a 64-bit version of your app provides performance improvements, makes way for future innovation, and sets you up for devices with 64-bit-only hardware.

This is what I got earlier today in my inbox from Google. It will be my mission today to fix this immediately because when I don’t do this now then I would totally forget about this later. So the first step is to check if I have any native code in the app.

The simplest way to check for 64-bit libraries is to inspect the structure of your APK file. When built, the APK will be packaged with any native libraries needed by the app. Native libraries are stored in various folders based on the ABI. It is not required to support every 64-bit architecture, but for each native 32-bit architecture you support you must include the corresponding 64-bit architecture.

For the ARM architecture, the 32-bit libraries are located in armeabi-v7a. The 64-bit equivalent is arm64-v8a.

For the x86 architecture, look for x86 for 32-bit and x86_64 for 64-bit.

The first thing to do is ensure that you have native libraries in both of these folders. To recap:

Platform 32-bit libraries folder 64-bit libraries folder
ARM lib/armeabi-v7a lib/arm64-v8a
x86 lib/x86 lib/x86_64

Note that depending on your app, there may or may not be exactly the same set of libraries in each folder. The goal is to ensure that your app runs correctly in a 64-bit-only environment.

In a typical case, an APK or bundle that’s built for both 32-bit and 64-bit architectures will have folders for both ABIs, each with a corresponding set of native libraries. If there’s no support for 64-bit, you’ll likely see a 32-bit ABI folder but not a 64-bit folder.

Here are the steps I took:

  1. Assemble a release APK
  2. Drag en dropped the APK in Android Studio so that he APK will get analysed.
  3. Looked within the lib folder, which is where you will find any ‘.so’ files. (If you can not find any ‘.so’ files in your app at all, then your app is already ready and no further action is required. If you see armeabi-v7a or x86, then you have 32-bit libraries.)
  4. Checked to see if I had similar ‘.so’ files in the arm64-v8a or x86_64 folder. (If you do not have any arm64-v8a or x86_64 libraries, you’ll need to update your build process to start building and packaging those artifacts in your APK.)

So great for my app everything was fine. But when checking the APK lib folders I noticed two folders not mentioned above in my APK.

  • MIPS
  • ARMEABI

I actually never heard of MIPS before and started booting up the browser to find out. I ended up with the following information:

ARMEABI

  • armeabi is very old ARM based architecture. Since Android 4.4, the compatibility definition strictly requires ARMv7

MIPS and MIPS64

  • There are no android devices with MIPS architecture in market.

So my first thoughts were

 

 

 

 

 

 

 

Since the app i’m working on minSDK is 21 (Android 5.0) I could safely remove the ARMEABI folder and MIPS wasn’t used anyway.

For removing certain ABI’s you can exclude them in the following statement in your build.gradle.

By removing MIPS and ARMEABI I decreased the app size with 5.9 MB which is a huge win! For this particular app it saved me 23% of the total APK size!

Add a Comment

Your email address will not be published. Required fields are marked *