How to get ABI (Application Binary Interface) in android

This may be a duplicate question, but I cannot find it. I wonder how we can get an ABI phone using a code. I know that there is another interface that can be dictated in the gradle file. But the problem is how can I get exactly the ABI of a particular device, so that I can manually copy it to the system / lib / folder using SuperSU. Thanks.

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") } 
+5
source share
2 answers

There are two ways to do this. One of them is outdated, but it still works, while the other requires that Android 5.0 or higher work on the phone.

Outdated way

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

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

New way

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

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

Both methods 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

+10
source

Look here:

enter image description here

does not exist?

Via the ADB shell:

 adb shell getprop ro.product.cpu.abi 

Although the Java code is:

 import android.os.Build; Log.d("myabi", Build.SUPPORTED_ABIS[0]); 
+3
source

Source: https://habr.com/ru/post/1242615/


All Articles