Skip to content

Instantly share code, notes, and snippets.

@erikchan002
Created June 1, 2026 10:43
Show Gist options
  • Select an option

  • Save erikchan002/45ab4755c7c32835f1370999b17ef168 to your computer and use it in GitHub Desktop.

Select an option

Save erikchan002/45ab4755c7c32835f1370999b17ef168 to your computer and use it in GitHub Desktop.
Pull all APKs via adb into directory
if [ -z "$1" ]; then
echo "Error: Package is empty or missing. Example: $0 com.example.app" >&2
exit 1
fi
VERSION=$(adb shell dumpsys package $1 | grep versionName | cut -d= -f2 | head -n 1)
DIR="$1-$VERSION"
if [ -n "$2" ]; then
DIR="$2"
fi
mkdir -p "$DIR"
PATHS=$(adb shell pm path $1 | cut -d: -f2)
for path in $PATHS; do
echo "Pulling $path"
adb pull "$path" "$DIR/$(basename "$path")"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment