3

For a particular installed app (in my case, com.android.chrome), is there a way to tell which ABI is being used (e.g., arm64-v8a)?

I know I could launch the app and run file on /proc/<PID>/exe but I'm wondering if there's a way to do this by examining the app itself.

0

2 Answers 2

5

Modern apps installed from Google Play Store consist of multiple APK files (also known as split APK files). If the app contains native .so files those files are usually packed per-ABI (e.g. armeabi-v7a arm64-v8a x86 or x86_64) and only the matching ABI file is downloaded and installed.

Therefore for some apps you can check the installed ABI by listing all APK files that belong to an app:

adb shell pm path <packagename>

Example:

package:/data/app/.../com.example.app-SO6ebvL9yDViMlHkHQ6NPw==/base.apk
package:/data/app/.../com.example.app-SO6ebvL9yDViMlHkHQ6NPw==/split_config.arm64_v8a.apk
package:/data/app/.../com.example.app-SO6ebvL9yDViMlHkHQ6NPw==/split_config.xxhdpi.apk

If the APK list contains an entry that ends with arm64_v8a.apk and no other APK file contains in it's file-name an other ABI name then you know that the arm64_v8a ABI version is installed and used.

Unfortunately this can only work for split APKs. And even for some split APK apps it doesn't work for an unknown reason - com.android.chrome is one of those apps that is a split app with platform dependent so files but none of the APK files have an indicator in the file-name which ABI is installed.

2
  • For universal APK, can it be generally detected by the device's SoC instead?
    – Andrew T.
    Commented Sep 1, 2022 at 15:50
  • @AndrewT. Only if the universal APK is really universal. But some single APK apps do only contain libraries for a certain subset of ABIs, e.g. if an game is older it may only contain armv7a ABI or newer games may only contain arm64-v8a and if the app is designed not to be executed on an emulator x86 ABIs may missing.
    – Robert
    Commented Sep 1, 2022 at 19:37
4

To add to @Robert's reply, if the application has no native libraries, it means it is platform independent, so you can get the ABI from adb shell getprop ro.product.cpu.abi.

In the other case, suppose you have a phone with arm64-v8a and com.android.chrome only has a native library for armeabi-v7a, you can run adb shell pm dump <packagename> | grep primaryCpuAbi and get the app's ABI.

Example:

$ adb shell pm dump com.android.chrome | grep primaryCpuAbi

    primaryCpuAbi=armeabi-v7a

$ adb shell pm dump com.example.platform.independent | grep primaryCpuAbi

    primaryCpuAbi=null

You can also try adb shell pm dump <packagename> | grep -A 3 "Dexopt state:"

Example arm:

Dexopt state:
  [com.example.nativelib]
    path: /data/app/~~ThisIsAnExampleAAAAAAA==/com.example.nativelib-ThisIsAnExampleAAAAAAA==/base.apk
      arm: [status=quicken] [reason=bg-dexopt]

Example arm64:

Dexopt state:
  [com.android.dialer]
    path: /system/product/priv-app/Dialer/Dialer.apk
      arm64: [status=speed-profile] [reason=bg-dexopt]
1
  • pm dump com.android.chrome | grep primaryCpuAbi shows both arm64-v8a and armeabi-v7a. The process is 64-bit. Commented Sep 1, 2022 at 19:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .