Use the Package Manager (pm) to find the full path to the APK(s):
$ adb shell pm path com.my.app
package:/data/app/com.my.app-CsuC-2Y4o9rd8b_Yovehfg==/base.apk
package:/data/app/com.my.app-CsuC-2Y4o9rd8b_Yovehfg==/split_config.armeabi_v7a.apk
package:/data/app/com.my.app-CsuC-2Y4o9rd8b_Yovehfg==/split_config.fr.apk
package:/data/app/com.my.app-CsuC-2Y4o9rd8b_Yovehfg==/split_config.xhdpi.apk
Then pull each individual APK with adb pull
(after having stripped package:
from the output):
$ adb pull /data/app/com.my.app-CsuC-2Y4o9rd8b_Yovehfg==/base.apk
/data/app/com.my.app-CsuC-2Y4o9rd8b_Yovehfg==/base.apk: 1 file pulled, 0 skipped. 19.5 MB/s (5803287 bytes in 0.284s)
$ adb pull /data/app/com.my.app-CsuC-2Y4o9rd8b_Yovehfg==/split_config.armeabi_v7a.apk
/data/app/com.my.app-CsuC-2Y4o9rd8b_Yovehfg==/split_config.armeabi_v7a.apk: 1 file pulled, 0 skipped. 19.1 MB/s (49267959 bytes in 2.459s)
$ adb pull /data/app/com.my.app-CsuC-2Y4o9rd8b_Yovehfg==/split_config.fr.apk
/data/app/com.my.app-CsuC-2Y4o9rd8b_Yovehfg==/split_config.fr.apk: 1 file pulled, 0 skipped. 3.5 MB/s (24985 bytes in 0.007s)
$ adb pull /data/app/com.my.app-CsuC-2Y4o9rd8b_Yovehfg==/split_config.xhdpi.apk
/data/app/com.my.app-CsuC-2Y4o9rd8b_Yovehfg==/split_config.xhdpi.apk: 1 file pulled, 0 skipped. 15.5 MB/s (4464002 bytes in 0.274s)
download_apk.sh
:
#!/bin/sh
if test $# -lt 1 ; then
echo "Usage: download_apk.sh <app_name>"
exit 1
fi
for APK_PATH in $(adb shell pm path $1 | sed 's/package://g') ; do
echo -n "[INFO] Pulling $APK_PATH from device..."
adb pull $APK_PATH
done