This skill validates Android release builds end-to-end, ensuring ProGuard/R8, signing, mapping, and metadata are production-ready.
npx playbooks add skill hitoshura25/claude-devtools --skill android-release-validation
This skill validates Android release builds to catch issues before they reach production. Critical for ensuring ProGuard/R8 doesn't break functionality and that the release build is production-ready.
None required - skill will detect project configuration and validate accordingly.
⛔ This skill REQUIRES a connected device or running emulator. It cannot be skipped.
Check for connected devices:
adb devices
If output shows "List of devices attached" with no devices:
Option 1 - Start an emulator:
# List available AVDs
emulator -list-avds
# Start emulator in background
emulator -avd <AVD_NAME> -no-snapshot-save &
# Wait for device to be ready (may take 1-2 minutes)
adb wait-for-device
adb shell getprop sys.boot_completed # Should return "1" when ready
Option 2 - Connect physical device:
DO NOT PROCEED until adb devices shows a connected device.
If user cannot provide a device/emulator:
Verify prerequisites are met:
// Check that release build is configured
// - signingConfig exists
// - isMinifyEnabled = true
// - proguard-rules.pro exists
// Check that tests exist
// - androidTest directory exists
// - At least one test file present
// Check that keystore is configured
// - For local: gradle.properties has signing config
// - For CI: environment variables are available
Ask the user:
Start with clean slate:
./gradlew clean
# Remove build outputs
rm -rf app/build/outputs/
# Optional: Clear gradle cache for fresh build
# rm -rf .gradle/
Why: Ensures we're testing a fresh build, not using cached artifacts.
Build release APK with ProGuard/R8:
./gradlew assembleRelease
# Expected output location:
# app/build/outputs/apk/release/app-release.apk
Validations:
Capture:
Build release AAB for Play Store:
./gradlew bundleRelease
# Expected output location:
# app/build/outputs/bundle/release/app-release.aab
Validations:
Capture:
Verify APK/AAB is properly signed:
# Verify APK signature (supports APK Signature Scheme v2/v3)
$ANDROID_HOME/build-tools/34.0.0/apksigner verify --verbose app/build/outputs/apk/release/app-release.apk
# Or if apksigner is in PATH:
apksigner verify --verbose app/build/outputs/apk/release/app-release.apk
# Check AAB signature (extract first)
unzip -p app/build/outputs/bundle/release/app-release.aab META-INF/MANIFEST.MF
Expected output for APK:
Verifies
Verified using v1 scheme (JAR signing): true
Verified using v2 scheme (APK Signature Scheme v2): true
Verified using v3 scheme (APK Signature Scheme v3): true
Validations:
Warnings:
Check mapping file exists and is valid:
# Default location
ls -lh app/build/outputs/mapping/release/mapping.txt
# Verify file is not empty
[ -s app/build/outputs/mapping/release/mapping.txt ] && echo "Mapping file OK" || echo "Mapping file EMPTY"
# Check file size (should be substantial if minification is working)
du -h app/build/outputs/mapping/release/mapping.txt
Validations:
Why Critical:
Without mapping file:
Use Android tools to analyze APK:
# Get APK info (package name, version, permissions)
aapt dump badging app/build/outputs/apk/release/app-release.apk
# Get detailed APK contents
aapt list -v app/build/outputs/apk/release/app-release.apk
# Check for debug symbols (should not be present in release)
aapt list -v app/build/outputs/apk/release/app-release.apk | grep -i debug
# Analyze APK with apkanalyzer (if available)
apkanalyzer apk summary app/build/outputs/apk/release/app-release.apk
Extract and validate:
Warnings:
This is the key validation step for ProGuard/R8.
Configure app/build.gradle.kts to test against release:
android {
testBuildType = "release"
}
Then run:
./gradlew connectedAndroidTest
This:
Expected output:
> Task :app:connectedReleaseAndroidTest
Tests on Pixel_6_API_34 - 14
SmokeTest > appLaunches_doesNotCrash PASSED
SmokeTest > appLaunches_hasVisibleContent PASSED
2 tests, 2 passed, 0 failed
If you need to test a pre-built release APK:
# 1. Build release APK
./gradlew assembleRelease
# 2. Build release-signed test APK
# First, temporarily set testBuildType = "release" in build.gradle.kts
./gradlew assembleReleaseAndroidTest
# 3. Install both APKs
adb install app/build/outputs/apk/release/app-release.apk
adb install app/build/outputs/apk/androidTest/release/app-release-androidTest.apk
# 4. Run tests
adb shell am instrument -w \
-e class {PACKAGE_NAME}.SmokeTest \
{PACKAGE_NAME}.test/androidx.test.runner.AndroidJUnitRunner
This indicates ProGuard removed something needed:
adb logcat -d | grep -E "ClassNotFoundException|NoSuchMethodError|NoSuchFieldError"
proguard-rules.pro: # Keep the class that was removed
-keep class com.example.MissingClass { *; }
# Keep classes used by reflection
-keepclassmembers class * {
@com.google.gson.annotations.SerializedName <fields>;
}
Manual validation steps:
# Uninstall any existing version
adb uninstall com.example.app
# Install release APK
adb install app/build/outputs/apk/release/app-release.apk
# Launch app
adb shell am start -n com.example.app/.MainActivity
# Check for crashes in logcat
adb logcat -T 1 | grep -i "crash\|fatal\|error"
Manual checks:
Check APK is optimized:
# Check uncompressed APK size
unzip -l app/build/outputs/apk/release/app-release.apk | tail -1
# Check for large resources
unzip -l app/build/outputs/apk/release/app-release.apk | sort -k4 -n -r | head -20
# Verify resources are optimized
# - Images should be compressed
# - Unused resources should be removed (shrinkResources = true)
Optimization checks:
Size thresholds:
CRITICAL: This step is MANDATORY and must pass before completing the skill.
Execute actual validation:
# 1. REQUIRED: Build release APK and AAB
./gradlew clean
./gradlew bundleRelease
./gradlew assembleRelease
# 2. REQUIRED: Verify outputs exist
ls -lh app/build/outputs/bundle/release/app-release.aab
ls -lh app/build/outputs/apk/release/app-release.apk
ls -lh app/build/outputs/mapping/release/mapping.txt
# 3. REQUIRED: Verify signing
apksigner verify --verbose app/build/outputs/apk/release/app-release.apk
# 4. REQUIRED: Install release APK and run smoke tests
adb uninstall {PACKAGE_NAME} || true
adb install app/build/outputs/apk/release/app-release.apk
./gradlew assembleDebugAndroidTest
adb install app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk
adb shell am instrument -w -e class {PACKAGE_NAME}.SmokeTest {PACKAGE_NAME}.test/androidx.test.runner.AndroidJUnitRunner
# 5. REQUIRED: Verify ProGuard mapping is not empty
[ -s app/build/outputs/mapping/release/mapping.txt ] && echo "✓ Mapping file OK" || echo "✗ Mapping file empty"
Expected output:
If ANY fail:
Common Failures:
Create comprehensive validation report:
# Release Build Validation Report
**Build Date:** {DATE}
**Version:** {VERSION_NAME} ({VERSION_CODE})
**Package:** {PACKAGE_NAME}
## Build Status
### APK Build
- Status: ✓ Success / ✗ Failed
- Size: {APK_SIZE} MB
- Location: app/build/outputs/apk/release/app-release.apk
- Build time: {BUILD_TIME} seconds
### AAB Build
- Status: ✓ Success / ✗ Failed
- Size: {AAB_SIZE} MB
- Location: app/build/outputs/bundle/release/app-release.aab
- Build time: {BUILD_TIME} seconds
## Configuration
### SDK Versions
- Minimum SDK: {MIN_SDK}
- Target SDK: {TARGET_SDK}
- Compile SDK: {COMPILE_SDK}
### ProGuard/R8
- Minification: ✓ Enabled
- Resource Shrinking: ✓ Enabled
- Mapping file: ✓ Present ({MAPPING_SIZE} KB)
### Signing
- Signed: ✓ Yes
- Algorithm: {ALGORITHM}
- Certificate: {CERTIFICATE_INFO}
## Test Results
### E2E Tests on Release
- Total tests: {TOTAL}
- Passed: {PASSED}
- Failed: {FAILED}
- Skipped: {SKIPPED}
{TEST_DETAILS}
## APK Analysis
### Size Breakdown
- DEX files: {DEX_SIZE} MB ({DEX_PERCENT}%)
- Resources: {RES_SIZE} MB ({RES_PERCENT}%)
- Native libs: {LIB_SIZE} MB ({LIB_PERCENT}%)
- Assets: {ASSET_SIZE} MB ({ASSET_PERCENT}%)
- Other: {OTHER_SIZE} MB ({OTHER_PERCENT}%)
### Permissions
{PERMISSIONS_LIST}
### Large Files (Top 10)
{LARGE_FILES}
## Issues Found
### Critical Issues
{CRITICAL_ISSUES}
### Warnings
{WARNINGS}
## Recommendations
{RECOMMENDATIONS}
## Validation Summary
Overall Status: ✓ PASSED / ✗ FAILED
{SUMMARY}
---
Generated: {TIMESTAMP}
Provide clear summary:
✅ Android Release Build Validation Complete!
📦 Build Artifacts:
APK: app/build/outputs/apk/release/app-release.apk ({APK_SIZE} MB)
AAB: app/build/outputs/bundle/release/app-release.aab ({AAB_SIZE} MB)
Mapping: app/build/outputs/mapping/release/mapping.txt
✓ Build Status:
✓ APK build succeeded
✓ AAB build succeeded
✓ ProGuard/R8 completed successfully
✓ Signed with release keystore
✓ Tests:
✓ {PASSED}/{TOTAL} E2E tests passed on release build
✓ No crashes during testing
✓ All critical paths validated
✓ Configuration:
✓ ProGuard enabled and working
✓ Mapping file generated
✓ Resource shrinking active
✓ Target SDK 34 (meets Play Store requirements)
✓ Quality Checks:
✓ APK size reasonable ({APK_SIZE} MB)
✓ No debug symbols in release
✓ Signature valid
✓ Permissions appropriate
⚠️ Warnings:
{WARNINGS_IF_ANY}
📋 Next Steps:
If validation passed:
1. Save ProGuard mapping file securely
2. Ready for Play Store upload
3. Use android-playstore-publishing skill for deployment
If validation failed:
1. Review issues listed above
2. Fix ProGuard rules if tests failed
3. Address any critical warnings
4. Re-run validation
ProGuard Mapping:
- Save to version control (encrypted/secure location)
- Upload to Play Console with release
- Store for crash deobfuscation
🔒 Security Reminders:
- Never commit release APK/AAB to git
- Store mapping files securely
- Protect signing keystore
- Review permissions before release
ProGuard/R8 errors:
Error: program class missing: com.example.SomeClass
Solution:
Add keep rule to proguard-rules.pro:
-keep class com.example.SomeClass { *; }
Build timeout:
Common causes:
Solution:
Using wrong keystore:
Signature algorithm weak:
Causes:
Solution:
Size optimization:
isShrinkResources = trueThis skill integrates with:
android-release-build-setup - Provides release build configurationandroid-e2e-testing-setup - Provides tests to runandroid-playstore-publishing - Uses validated build for deploymentandroid-playstore-pipeline - Part of complete release workflowInstall Android SDK build-tools:
# Via Android Studio SDK Manager
# Or via command line
sdkmanager "build-tools;34.0.0"
Install Android SDK build-tools:
# Via Android Studio SDK Manager
# Or via command line
sdkmanager "build-tools;34.0.0"
# Or add to PATH if already installed:
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/build-tools/34.0.0
This is the exact issue this validation catches!
Created:
validation-report.md - Detailed validation reportvalidation-summary.json - Machine-readable summaryModified:
Temporary:
app/build/ - Build outputs (can be cleaned)Preserved:
app/build/outputs/mapping/release/mapping.txt - MUST keep for crash reportsDo NOT mark this skill as complete unless ALL of the following are verified:
✅ Validation script created
✅ Validation workflow created
✅ MANDATORY: Validation execution
adb devices shows device)testBuildType = "release" configured in build.gradle.kts (for release validation)./gradlew connectedAndroidTest succeeds with release buildapksigner verify passes)app/build/outputs/mapping/release/mapping.txtIf no device available: FAIL. Do not skip.
If signature mismatch error: Verify testBuildType = "release" is set.
✅ Validation report generated
**If ANY checkbox is
Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.