9

I am writing a script to test a large quantity of apks. Some run on x86 and some run on arm. Is there a way I can tell which apks are intended for which architecture?

I have looked through the report on aapt badging with aapt dump badging application.apk. For some of the arm compatible versions I see native-code: 'armeabi-v7a' but not for all of them, and I don't see any indication of what architecture the x86 compatible apks run on.

I have also tried using apktool to break apart the apk and examine the AndroidManifest.xml. I don't see anything pertaining to the chip architecture in it either.

Any ideas?

  • Didn't know apks were architecture dependent... Would like to know the answer as well. – esQmo_ Feb 2 '17 at 22:50
  • 5
    The Java part of the apps is cross platform (meaning a Java-only app will run on any architecture without any need for modification), however any native libraries it's bundled with have to be compiled for each ABI (application binary interface, i.e. architecture) separately (assuming the app wants to support each of those ABIs). An APK can include native code for specific set of ABIs, or all of the Android supported ones (depends on how it was built), and they're usually bundled under architecture-specific folders in the APK. – Joe Feb 2 '17 at 22:58
  • 1
    @Joe Coming in to say the same. Please make it an answer with some example screenshots and any additional info you know. – Andy Yan Feb 3 '17 at 0:26
13

One (rather crude) way to see what architecture an APK's native libraries are built for is to unzip it (it's only a zip file) and take a look at the libs folder - if the application contains any native libraries, they will be split into the following subfolders inside (with the compiled libraries inside these):

See Android Application Package for more information on an APK's structure, and the above list's source. A more complete (including MIPS64) list, along with some information about architecture-specific things, can be found on an archived version of the Android Developer ABI Management page, captured on April 18th 2016.

Interestingly enough, targeting one single ABI (where an app includes native libraries designed for one architecture) doesn't necessarily mean that the app won't run on devices that use other architectures. ARMv8-a, for example, is backwards compatible with ARM and ARMv7-a, and Intel's x86 Android devices contain a proprietary translation layer that allows ARM code to execute on x86 devices (allowing ARM-only apps to run on x86 platforms). A list of the ABIs that an Android device can execute can be found in the ro.product.cpu.abilist property, which can be attained in a shell (e.g. via a terminal app on the device, or over adb using adb shell) using the getprop command: getprop ro.product.cpu.abilist.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.