Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get ABI (Application Binary Interface) in android

Tags:

android

abi

It may be a duplicated question, but i'm unable to find it. I wonder how we can get what's the ABI of a phone, using code. I know that there's different Interface that may dictated in gradle file. But the problem is how i can get exactly the ABI of a certain device, so that i can manually copy it to system/lib/ folder using SuperSU. Thank you.

android.productFlavors {         // for detailed abiFilter descriptions, refer to "Supported ABIs" @         // https://developer.android.com/ndk/guides/abis.html#sa         create("arm") {             ndk.abiFilters.add("armeabi")         }         create("arm7") {             ndk.abiFilters.add("armeabi-v7a")         }         create("arm8") {             ndk.abiFilters.add("arm64-v8a")         }         create("x86") {             ndk.abiFilters.add("x86")         }         create("x86-64") {             ndk.abiFilters.add("x86_64")         }         create("mips") {             ndk.abiFilters.add("mips")         }         create("mips-64") {             ndk.abiFilters.add("mips64")         }         // To include all cpu architectures, leaves abiFilters empty         create("all")     } 
like image 573
Cuong Phan Avatar asked Feb 09 '16 12:02

Cuong Phan


People also ask

How do I find my ABI on my Android?

If you are interested in the ABI that current process/runtime is running under (e.g. an arm64/x86_64 processor can run a 32-bit app_process to save memory), you should use CPU_ABI , CPU_ABI2 as it will return the correct result.

How do I know if my phone is ABI?

For the Android version, look at the OS version under the Device section. This explicitly displays the version number. For architecture info, slide over to the System tab and check out the CPU Architecture and Instruction Sets entries under the Processor tab.

What is arm64 v8a in Android?

arm64-v8a is the more recent 64 bit target (similar to the 32-bit -> 64 bit transition in desktop computers). I think most new devices are 64 bit, but not sure. arm64-v8a devices can run code compiled against armeabi-v7a, it's backwards compatible.

What does ABI mean in Android?

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.

What is Abi management in Android?

ABI Management. Different Android handsets use different CPUs, which in turn support different instruction sets. Each combination of CPU and instruction sets has its own Application Binary Interface, or ABI. The ABI defines, with great precision, how an application's machine code is supposed to interact with the system at runtime.

What is application binary interface (ABI)?

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.

What are Abis in Android?

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.

What parts of the ABI are in the Android variant?

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


1 Answers

There are two ways that you can do this. One is deprecated but still works while the other requires the phone to be running Android 5.0 or greater.

The Deprecated Way

If you want to support all current phones you can use:

import android.os.Build; String ABI = Build.CPU_ABI; 

The Newer Way

The newer way actually will provide a list of all supported ABIs, the first index being the most preferred ABI to use (API Reference):

import android.os.Build; String ABI = Build.SUPPORTED_ABIS[0]; 

Both ways have been tested to work on Android 5.1.1, they will return one of the following:

  • armeabi
  • armeabi-v7a
  • armeabi-v7a-hard
  • arm64-v8a
  • x86
  • x86_64
  • mips
  • mips64

Future ABIs should be listed here: https://developer.android.com/ndk/guides/abis.html#sa

like image 84
brandonhuddle Avatar answered Sep 18 '22 07:09

brandonhuddle