This article is a quick overview on the types of Android processor instruction set types, known as an ABI (Application Binary Interface) and how to determine which ones your device supports.
In order to include any compiled native C libraries, such as “mylib.so” into your Android application, it needs to be compiled it for a specific ABI.
ABIs found on Android are in 3 categories:
- armeabi-v7a (Typically also supports armeabi)
- arm64-v8a (Typically also supports armeabi and armeabi-v7a)
- x86_64 (Typically also supports x86)
- mips64 (Typically also supports mips)
When including native libraries into your app, you’ll typically see them packaged within an AAR dependency, but sometimes you will have to add them manually. When you have to add them manually you will have to structure your dependencies to tell which ABI the code is compiled for.
- app/libs/armeabi/mylib.so or
“armeabi-v7a” is BY FAR the most widely seen ABI on Android. About 90+% of all phones made in the last few years supports this. x86 is only on a few devices including the The Asus Zenphone 2, Genymotion Emulator and some Android Emulator images. I’ve never even heard of any modern android device using a “mips” based processor.
To figure out what type of ABI your Android device has, you have two methods. You can do it with an ADB (Android Debug Bridge) command, or programmatically through code.
- Pre-Lollipop devices:
- Lollipop and higher:
- ADB command:
- adb shell getprop ro.product.cpu.abilist
- ADB command:
- Intel Developer Zone Documentation: https://software.intel.com/en-us/blogs/2014/12/16/how-to-identify-the-image-is-32-bit-or-64-bit-user-space
- Android Documentation on ABIs: http://developer.android.com/ndk/guides/abis.html
- Android Documentation on android.os.Build: http://developer.android.com/reference/android/os/Build.html