Xavier Rubio Jansana

Xavier Rubio Jansana

Mobile engineer.
Android and iOS.
Scuba diver.

© 2024

Android compatibility with 32-bit libraries on a 64-bit device, updated

Sometime ago I wrote the following post: Android compatibility with 32-bit libraries on a 64-bit device.

In that article, the proposed solution was to manually remove the library files that were causing the problem using exclude. See that article for the details on the reasons to do that.

There’s a better way using ABI Filters, though.

android {
    // ...
    buildTypes {
        // ...
        release {
            ndk {
                abiFilters "armeabi", "armeabi-v7a", "x86"
            }
        }
    }
}

With ABI Filters we specify the architectures that we want to keep, which is the opposite of what we were previously doing, which was manually removing the libraries we didn’t want to keep. So, what we’re doing is keeping 32-bit architectures, both for ARM and x86 (we’re excluding 64-bit libraries and MIPS).

Notice that nowadays I would also exclude "armeabi", as all the nowadays devices use at least "armeabi-v7a".

Finally, notice that by August 2019 all the apps using native libraries will have to provide both 32 and 64-bit versions, as Google states in the blog post “Improving app security and performance on Google Play for years to come”:

In August 2019, Play will require that new apps and app updates with native libraries provide 64-bit versions in addition to their 32-bit versions.

See also Reducing APK size by using ABI Filters and APK split by Igor Wojda for other uses of ABI Filters.