Android ABIs

Different Android devices use different CPUs, which in turn support different instruction sets. Each combination of CPU and instruction set has its own Application Binary Interface (ABI). An ABI includes the following information:

  • The CPU instruction set (and extensions) that can be used.
  • The endianness of memory stores and loads at runtime. Android is always little-endian.
  • Conventions for passing data between applications and the system, including alignment constraints, and how the system uses the stack and registers when it calls functions.
  • The format of executable binaries, such as programs and shared libraries, and the types of content they support. Android always uses ELF. For more information, see ELF System V Application Binary Interface.
  • How C++ names are mangled. For more information, see Generic/Itanium C++ ABI.

This page enumerates the ABIs that the NDK supports, and provides information about how each ABI works.

ABI can also refer to the native API supported by the platform. For a list of those kinds of ABI issues affecting 32-bit systems, see 32-bit ABI bugs.

Supported ABIs

Table 1. ABIs and supported instruction sets.

ABI Supported Instruction Sets Notes
  • armeabi
  • Thumb-2
  • VFPv3-D16
  • Incompatible with ARMv5/v6 devices.
  • AArch64
  • x86
  • x86 (IA-32)
  • MMX
  • SSE/2/3
  • SSSE3
  • No support for MOVBE or SSE4.
  • x86-64
  • MMX
  • SSE/2/3
  • SSSE3
  • SSE4.1, 4.2
  • Note: Historically the NDK supported ARMv5 (armeabi), and 32-bit and 64-bit MIPS, but support for these ABIs was removed in NDK r17.


    This ABI is for 32-bit ARM-based CPUs. The Android variant includes Thumb-2 and the VFP hardware floating point instructions, specifically VFPv3-D16, which includes 16 dedicated 64-bit floating point registers.

    For information about the parts of the ABI that aren't Android-specific, see Application Binary Interface (ABI) for the ARM Architecture

    The NDK's build systems generate Thumb-2 code by default unless you use LOCAL_ARM_MODE in your for ndk-build or ANDROID_ARM_MODE when configuring CMake.

    Other extensions including Advanced SIMD (Neon) and VFPv3-D32 are optional. For more information, see Neon Support.

    The armeabi-v7a ABI uses -mfloat-abi=softfp to enforce the rule that, although system can execute floating-point code, the compiler must pass all float values in integer registers and all double values in integer register pairs when making function calls.


    This ABI is for ARMv8-A based CPUs, which support the 64-bit AArch64 architecture. It includes the Advanced SIMD (Neon) architecture extensions.

    You can use Neon intrinsics in C and C++ code to take advantage of the Advanced SIMD extension. The Neon Programmer's Guide for Armv8-A provides more information about Neon intrinsics and Neon programming in general.

    See Arm's Learn the Architecture for complete details of the parts of the ABI that aren't Android-specific. Arm also offers some porting advice in 64-bit Android Development.

    On Android, the platform-specific x18 register is reserved for ShadowCallStack and should not be touched by your code. Current versions of Clang default to using the -ffixed-x18 option on Android, so unless you have hand-written assembler (or a very old compiler) you shouldn't need to worry about this.


    This ABI is for CPUs supporting the instruction set commonly known as "x86", "i386", or "IA-32". Characteristics of this ABI include:

    • Instructions normally generated by GCC with compiler flags such as the following:
      -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32

      These flags target the Pentium Pro instruction set, along with the the MMX, SSE, SSE2, SSE3, and SSSE3 instruction set extensions. The generated code is an optimization balanced across the top Intel 32-bit CPUs.

      For more information on compiler flags, particularly related to performance optimization, refer to GCC x86 Performance Hints.

    • Use of the standard Linux x86 32-bit calling convention, as opposed to the one for SVR. For more information, see section 6, "Register Usage", of Calling conventions for different C++ compilers and operating systems.

    The ABI does not include any other optional IA-32 instruction set extensions, such as:

    • MOVBE
    • Any variant of SSE4.

    You can still use these extensions, as long as you use runtime feature-probing to enable them, and provide fallbacks for devices that do not support them.

    The NDK toolchain assumes 16-byte stack alignment before a function call. The default tools and options enforce this rule. If you are writing assembly code, you must make sure to maintain stack alignment, and ensure that other compilers also obey this rule.

    Refer to the following documents for more details:


    This ABI is for CPUs supporting the instruction set commonly referred to as "x86-64." It supports instructions that GCC typically generates with the following compiler flags:

    -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel

    These flags target the x86-64 instruction set, according to the GCC documentation. along with the MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, and POPCNT instruction-set extensions. The generated code is an optimization balanced across the top Intel 64-bit CPUs.

    For more information on compiler flags, particularly related to performance optimization, refer to GCC x86 Performance Hints.

    This ABI does not include any other optional x86-64 instruction set extensions, such as:

    • MOVBE
    • SHA
    • AVX
    • AVX2

    You can still use these extensions, as long as you use runtime feature probing to enable them, and provide fallbacks for devices that do not support them.

    Refer to the following documents for more details:

    Generate code for a specific ABI


    Gradle (whether used via Android Studio or from the command line) builds for all non-deprecated ABIs by default. To restrict the set of ABIs that your application supports, use abiFilters. For example, to build for only 64-bit ABIs, set the following configuration in your build.gradle:

    android {
        defaultConfig {
            ndk {
                abiFilters 'arm64-v8a', 'x86_64'


    ndk-build builds for all non-deprecated ABIs by default. You can target a specific ABIs by setting APP_ABI in your file. The following snippet shows a few examples of using APP_ABI:

    APP_ABI := arm64-v8a  # Target only arm64-v8a
    APP_ABI := all  # Target all ABIs, including those that are deprecated.
    APP_ABI := armeabi-v7a x86_64  # Target only armeabi-v7a and x86_64.

    For more information on the values you can specify for APP_ABI, see


    With CMake, you build for a single ABI at a time and must specify your ABI explicitly. You do this with the ANDROID_ABI variable, which must be specified on the command line (cannot be set in your CMakeLists.txt). For example:

    $ cmake -DANDROID_ABI=arm64-v8a ...
    $ cmake -DANDROID_ABI=armeabi-v7a ...
    $ cmake -DANDROID_ABI=x86 ...
    $ cmake -DANDROID_ABI=x86_64 ...

    For the other flags that must be passed to CMake to build with the NDK, see the CMake guide.

    The default behavior of the build system is to include the binaries for each ABI in a single APK, also known as a fat APK. A fat APK is significantly larger than one containing only the binaries for a single ABI; the tradeoff is gaining wider compatibility, but at the expense of a larger APK. It is strongly recommended that you take advantage of either App Bundles or APK Splits to reduce the size of your APKs while still maintaining maximum device compatibility.

    At installation time, the package manager unpacks only the most appropriate machine code for the target device. For details, see Automatic extraction of native code at install time.

    ABI management on the Android platform

    This section provides details about how the Android platform manages native code in APKs.

    Native code in app packages

    Both the Play Store and Package Manager expect to find NDK-generated libraries on filepaths inside the APK matching the following pattern:


    Here, <abi> is one of the ABI names listed under Supported ABIs, and <name> is the name of the library as you defined it for the LOCAL_MODULE variable in the file. Since APK files are just zip files, it is trivial to open them and confirm that the shared native libraries are where they belong.

    If the system does not find the native shared libraries where it expects them, it cannot use them. In such a case, the app itself has to copy the libraries over, and then perform dlopen().

    In a fat APK, each library resides under a directory whose name matches a corresponding ABI. For example, a fat APK may contain:


    Note: ARMv7-based Android devices running 4.0.3 or earlier install native libraries from the armeabi directory instead of the armeabi-v7a directory if both directories exist. This is because /lib/armeabi/ comes after /lib/armeabi-v7a/ in the APK. This issue is fixed from 4.0.4.

    Android platform ABI support

    The Android system knows at runtime which ABI(s) it supports, because build-specific system properties indicate:

    • The primary ABI for the device, corresponding to the machine code used in the system image itself.
    • Optionally, secondary ABIs, corresponding to other ABI that the system image also supports.

    This mechanism ensures that the system extracts the best machine code from the package at installation time.

    For best performance, you should compile directly for the primary ABI. For example, a typical ARMv5TE-based device would only define the primary ABI: armeabi. By contrast, a typical, ARMv7-based device would define the primary ABI as armeabi-v7a and the secondary one as armeabi, since it can run application native binaries generated for each of them.

    64-bit devices also support their 32-bit variants. Using arm64-v8a devices as an example, the device can also run armeabi and armeabi-v7a code. Note, however, that your application will perform much better on 64-bit devices if it targets arm64-v8a rather than relying on the device running the armeabi-v7a version of your application.

    Many x86-based devices can also run armeabi-v7a and armeabi NDK binaries. For such devices, the primary ABI would be x86, and the second one, armeabi-v7a.

    You can force install an apk for a specific ABI. This is useful for testing. Use the following command:

    adb install --abi abi-identifier path_to_apk

    Automatic extraction of native code at install time

    When installing an application, the package manager service scans the APK, and looks for any shared libraries of the form:


    If none is found, and you have defined a secondary ABI, the service scans for shared libraries of the form:


    When it finds the libraries that it's looking for, the package manager copies them to /lib/lib<name>.so, under the application's native library directory (<nativeLibraryDir>/). The following snippets retrieve the nativeLibraryDir:


    val ainfo = this.applicationContext.packageManager.getApplicationInfo(
    Log.v(TAG, "native library dir ${ainfo.nativeLibraryDir}")


    ApplicationInfo ainfo = this.getApplicationContext().getPackageManager().getApplicationInfo
    Log.v( TAG, "native library dir " + ainfo.nativeLibraryDir );

    If there is no shared-object file at all, the application builds and installs, but crashes at runtime.