Pulling APK file from Playstore
Initial setup script (optimized for Ubuntu client)
#!/usr/bin/env bash
set -euo pipefail
#Config (edit API if you want Android 14 = 34)
API=35
IMG="system-images;android-${API};google_apis_playstore;x86_64"
AVD="pixel8_api${API}"
DEV="pixel_8"
SDK_DIR="$HOME/Android/Sdk"
TOOLS_VER="13114758"
TOOLS_ZIP="commandlinetools-linux-${TOOLS_VER}_latest.zip"
TOOLS_URL="https://dl.google.com/android/repository/${TOOLS_ZIP}"
# deps + kvm
sudo apt update -y
sudo apt install -y cpu-checker qemu-kvm unzip curl
command -v kvm-ok >/dev/null && kvm-ok || true
# install google cmdline tools to ~/Android/Sdk
mkdir -p "$SDK_DIR/cmdline-tools" && cd "$SDK_DIR"
curl -fL -o "$TOOLS_ZIP" "$TOOLS_URL"
unzip -o "$TOOLS_ZIP" -d cmdline-tools >/dev/null
mv -f cmdline-tools/cmdline-tools cmdline-tools/latest
# path (add to ~/.bashrc if needed)
export ANDROID_SDK_ROOT="$SDK_DIR"
export PATH="$PATH:$SDK_DIR/cmdline-tools/latest/bin:$SDK_DIR/platform-tools:$SDK_DIR/emulator"
# licenses and required components
yes | sdkmanager --licenses >/dev/null
sdkmanager "platform-tools" "emulator" "platforms;android-${API}" "${IMG}"
# create an AVD
avdmanager create avd -n "$AVD" -k "${IMG}" --device "$DEV" || true
echo "Setup done."
echo "Tip: add these to ~/.bashrc:"
echo 'export ANDROID_SDK_ROOT="$HOME/Android/Sdk"'
echo 'export PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/emulator"'
Run the script above with root privileges from Ubuntu client
chmod +x script.sh
bash ./script.shLaunch the emulator from a GUI session
emulator @pixel8_api35 -accel auto -netdelay none -netspeed full #change model as appropriateRun the emulator, login with burner Google account , install APK from playstore
#pull the installed apk form the emulator into the PC
mkdir -p ./apks/com.example.ExampleApp
adb shell pm path com.example.ExampleApp | sed 's/package://g' | tr -d '\r' > /tmp/paths.txt
sed -n '1,10p' /tmp/paths.txt
/data/app/~~-B9WzHY5gt0MArSA==/com.example.ExampleApp-YOrR1337777=/base.apk <-- This is the APK!
/data/app/~~-B9WzHY5gt0MArSA==/com.example.ExampleApp-YOrR1337777=/split_config.arm64_v8a.apk
/data/app/~~-B9WzHY5gt0MArSA==/com.example.ExampleApp-YOrR1337777=/split_config.xxhdpi.apk
Fetch the APK with:
adb pull "/data/app/~~-B9WzHY5gt0MArSA==/com.example.ExampleApp-YOrR1337777=/base.apk"
Last updated