← Back to list

Understanding ABIs (Application Binary Interfaces) in Android

What is an ABI?

Md. Mahbubur Rahman · 2024-07-04 14:02 · 46 claps · 2.6 min read
#android-app-development #android-gradle #android-gradle-plugin #dynamic-module #kotlin
Open on Medium ↗
Wiki topics: 📱 · Mobile Development

Understanding ABIs (Application Binary Interfaces) in Android

What is an ABI?

An Application Binary Interface (ABI) defines how different components of binary code can interface at a low level. It includes the details of data types, sizes, and alignments, the calling convention for functions, how an application’s machine code interacts with the operating system, and more. In Android, ABIs are crucial because they ensure that native libraries (usually written in C or C++) are compatible with the device’s CPU architecture.

Common ABIs in Android

  • armeabi-v7a: ARM-based 32-bit architecture. Widely supported across many Android devices.
  • arm64-v8a: ARM-based 64-bit architecture. Supports modern 64-bit devices, offering better performance and more memory.
  • x86: Intel’s 32-bit architecture. Used in some Android devices, primarily tablets and emulators.
  • x86_64: Intel’s 64-bit architecture. Used in some Android devices, primarily tablets and emulators.
  • mips and mips64: MIPS architectures. They are less common and mostly deprecated in newer Android versions.

Why ABIs are Important

  1. Compatibility: Ensures that your application can run on different devices with different CPU architectures.
  2. Performance: Using the appropriate ABI can enhance performance by utilizing the full capabilities of the CPU.
  3. Package Size: Including multiple ABIs can increase the APK size. Developers often split APKs or use ABI filters to manage this.

How ABIs Work in Android

  1. Native Libraries: When you include native code (e.g., using the NDK — Native Development Kit), you need to compile your code for different ABIs.
  2. ABI Filters: You can specify which ABIs your app supports using abiFilters in the build.gradle or build.gradle.kts file.
  3. Splitting APKs: To reduce the APK size, you can create different APKs for each ABI. This is called APK Splits.

Configuring ABIs in Gradle

Specifying ABI Filters

To specify which ABIs your app should support, you can use the abiFilters property in the defaultConfig block of your build.gradle.kts file:

android {
    ...
    defaultConfig {
        ...
        ndk {
            abiFilters += listOf("arm64-v8a", "armeabi-v7a", "x86", "x86_64")
        }
    }
}

This configuration tells Gradle to include only the specified ABIs in the final APK.

Splitting APKs by ABI

To generate separate APKs for each ABI, use the splits block:

android {
    ...
    splits {
        abi {
            enable = true
            reset()
            include("arm64-v8a", "armeabi-v7a", "x86", "x86_64")
            universalApk = false  // Set to true to create an APK that includes all ABIs
        }
    }
}

With this configuration, Gradle will generate separate APKs for each ABI, reducing the size of each APK and ensuring that users download only the APK for their specific device’s architecture.

Checking Supported ABIs

To see which ABIs your APK supports, you can use several methods:

  1. APK Analyzer:
  • Build your APK.
  • In Android Studio, go to Build > Analyze APK.
  • Select the APK you want to analyze.
  • In the APK Analyzer, expand the lib directory to see the supported ABIs.

2. Using aapt Tool:

  • Run the command: aapt dump badging path/to/your.apk.
  • This will show detailed information about the APK, including supported ABIs.

Important tips: Handling Native Libraries in Dynamic Features

When using dynamic feature modules with native libraries, ensure that all modules support the same set of ABIs (Application Binary Interfaces). Mismatched ABIs between the base and dynamic feature modules can cause build errors.

For example, if your dynamic module supports “arm64-v8a”, “armeabi-v7a”, “x86”, and “x86_64”, but the base module does not support the same ABIs, the build will fail when you try to generate a release file. By default, the base module supports “arm64-v8a”, “armeabi-v7a”, “x86”, “x86_64”, “mips”, and “mips64”. Ensure that the supported ABIs are consistent across all modules.

Conclusion

Managing ABIs effectively ensures that your application can run smoothly on various devices with different CPU architectures, optimizing both performance and compatibility. By understanding and configuring ABIs in your Android project, you can make informed decisions to balance APK size, compatibility, and performance.


메타데이터
post_id
393a268ac82e
slug
understanding-abis-application-binary-interfaces-in-android-393a268ac82e
url
https://medium.com/@mahbubmridha07/understanding-abis-application-binary-interfaces-in-android-393a268ac82e
canonical_url
https://medium.com/@mahbubmridha07/understanding-abis-application-binary-interfaces-in-android-393a268ac82e
author_url
https://medium.com/@mahbubmridha07
status
ok
fetched_at
2026-07-24 23:44:46