Last active
July 25, 2025 21:28
-
-
Save jimmy947788/fda2c3e355c63c76d4732ae91324ad53 to your computer and use it in GitHub Desktop.
use adb command pull latest version apk(s)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| PACKAGE_NAME=$1 | |
| adb kill-server && adb start-server | |
| VERSION=$(adb shell dumpsys package $PACKAGE_NAME | grep versionName) | |
| VERSION=$(echo $VERSION | cut -d'=' -f 2) | |
| echo "$PACKAGE_NAME ver:$VERSION" | |
| # VERSION not null | |
| if [ -z "$VERSION" ]; then | |
| echo "Failed to get versionName for package: $PACKAGE_NAME" | |
| exit 1 | |
| fi | |
| mkdir -p apk | |
| mkdir -p apk/$PACKAGE_NAME-$VERSION | |
| # 查詢並拉取所有 APK 檔案 | |
| APK_PATHS=$(adb shell pm path $PACKAGE_NAME | cut -d':' -f 2) | |
| for APK_PATH in $APK_PATHS; do | |
| APK_NAME=$(basename $APK_PATH) | |
| adb pull $APK_PATH apk/$PACKAGE_NAME-$VERSION/$APK_NAME | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
修正多個split apk 下載