If you want to run aapt read apk file information:
STEP 1: Download aapt-linux build-tool at https://androidaapt.com/
STEP 2: Copy the entire lib64
folder to usr/lib64
on centos
STEP 3: Copy the aapt
file to the usr/bin
directory and then chmod +x aapt
(755)
Example reading file version:
aapt dump badging myApp.apk | gawk $'match($0, /versionName=\'([^\']*)\'/, v) { print v[1] }'
Example reading file package name:
aapt dump badging myApp.apk| gawk $'match($0, /package: name=\'([^\']*)\'/, v) { print v[1] }'
In your script (my example is PHP):
$appVersion = shell_exec("aapt dump badging myApp.apk | gawk $'match($0, /versionName=\'([^\']*)\'/, v) { print v[1] }'";
echo $appVersion;
We have many information in APK:
aapt dump badging myApp.apk