whiskers.git / tools / inspect-apk.sh
1#!/usr/bin/env bash

Print what matters about a built APK: who signed it, what it asks for, which ABIs it carries.

mise run android:inspect -- [apk]    (or tools/inspect-apk.sh [apk] with ANDROID_HOME set)
5set -euo pipefail
6cd "$(dirname "$0")/.."
7apk="${1:-android/app/build/outputs/apk/debug/app-debug.apk}"
8: "${ANDROID_HOME:?set ANDROID_HOME (mise sets it)}"
9bt="$ANDROID_HOME/build-tools/${WHISKERS_ANDROID_BUILD_TOOLS:-$(ls "$ANDROID_HOME/build-tools" | sort -V | tail -1)}"
10"$bt/apksigner" verify --print-certs "$apk" | head -3
11"$bt/aapt2" dump badging "$apk" | grep -E '^package|sdkVersion|targetSdk|uses-permission|native-code|launchable'
12echo "baked-in endpoints:"
13unzip -p "$apk" 'classes*.dex' | strings | grep -E '^http://[0-9.]+:[0-9]+$|^claude-' | sort -u