vaz
vaz

Reputation: 330

How to find out which architecture version from a given .apk was used on a given app installation?

A single .apk file may contain NDK binaries targeting different architectures (eg. x86, x86-64, etc.). I suppose that, when installing on a given device, the corresponding binary is selected automatically dependening on the device architecture. However, since for instance 64-bit devices are often compatible with 32-bit software, I want to make sure that the corresponding binaries were installed.

EDIT: - I mean a local installation for testing purposes. - I know you can have different .apk's, each for one specific architecture. Assume there is a single one containing all architecture targets.

Upvotes: 0

Views: 6442

Answers (2)

Gr8Warrior
Gr8Warrior

Reputation: 719

Run : adb shell Run: dumpsys package packages | grep

It'll give you the path to external native directory i.e /data/app//lib/YOUR_INSTALLED_LIB_ARCHITECTURE Else you can use https://play.google.com/store/apps/details?id=com.xh.nativelibsmonitor.app this app it'll give the details of libraries packaged in your application as well as architecture of libs installed in your application.

Upvotes: 2

maxnorbi
maxnorbi

Reputation: 36

Specify the ABI in the installation process:

You can explicitly specify the ABI when installing an app with adb install by using the --abi option.

For Aarch32:

adb install --abi armeabi-v7a <YOUR_APK_FILE>.apk

For Aarch64:

adb install --abi arm64-v8a <YOUR_APK_FILE>.apk

Reference: https://developer.android.com/distribute/best-practices/develop/64-bit#test_your_app_on_64-bit_hardware

Check ABI of running process:

This may be considered as a Hack, but it works for me.

If you already installed the .apk and don't want to reinstall it, you can check the names of the .so files within the .apk file of interest (f.e. using mc). In my case they are located under /lib/armeabi-v7a and /lib/arm64-v8a. Then you can run your application on the device (in my case Android Nougat on aarch64) and do:

cat /proc/<PID_OF_YOUR_RUNNING_APP>/maps | grep <NAME_OF_SO_FILE>

For a .apk installed with --abi armeabi-v7a option, the pathname is:

/data/app/<APP_NAME>/lib/arm/<NAME_OF_SO_FILE>

with --abi arm64-v8a option:

/data/app/<APP_NAME>/lib/arm64/<NAME_OF_SO_FILE>

Reference for the proc filesystem: http://man7.org/linux/man-pages/man5/proc.5.html

Upvotes: 2

Related Questions