I use output from some commands to get path of .apk file and then pull that file from Android phone like this:
#!/bin/bash
#This command sets APK_PATH variable to /data/app/com.test.something-1/base.apk
APK_PATH="$(adb shell pm path com.test.something | cut -d':' -f 2)"
# adb pull command is being used to pull .apk file from phone when I have the path
adb pull $APK_PATH
This dynamic approach to getting .apk path and pulling file from phone doesn't work. It results with following error message:
' does not existdata/app/com.test.something-1/base.apk
However, when I hardcode path, it works perfectly:
#!/bin/bash
APK_PATH=/data/app/com.test.something-1/base.apk
adb pull $APK_PATH
Can anyone help me with this little piece of bash scripting? I believe that somehow APK_PATH is not yet set when 'adb pull' starts executing but can't fix it.