home / skills / hitoshura25 / claude-devtools / android-release-build-setup

android-release-build-setup skill

/skills/android-release-build-setup

This skill orchestrates Android release build setup by generating keystores, configuring ProGuard, and applying signing for CI and local dev.

npx playbooks add skill hitoshura25/claude-devtools --skill android-release-build-setup

Review the files below or copy the command above to add this skill to your agents.

Files (6)
SKILL.md
5.2 KB
---
name: android-release-build-setup
description: Complete Android release build configuration - orchestrates keystore, ProGuard, and signing setup
category: android
version: 2.0.0
---

# Android Release Build Setup

This skill orchestrates complete Android release build configuration by running three atomic skills in sequence.

## What This Does

Sets up everything needed for Android release builds:
1. **Keystore Generation** - Production and local dev keystores
2. **ProGuard/R8 Configuration** - Code minification and optimization
3. **Signing Configuration** - Dual-source signing (CI/CD + local dev)

## Prerequisites

- Android project with Gradle
- JDK installed (for keytool command)
- Project uses Kotlin DSL (build.gradle.kts)

## Process

This skill runs three sub-skills in order:

### Step 1: Generate Keystores

Follow the skill at: `~/claude-devtools/skills/android-keystore-generation/SKILL.md`

**What it does:**
- Creates production keystore (for CI/CD only)
- Creates local development keystore
- Generates KEYSTORE_INFO.txt with credentials
- Updates .gitignore

**Verify before continuing:**
```bash
ls keystores/*.jks
cat keystores/KEYSTORE_INFO.txt
```

---

### Step 2: Configure ProGuard/R8

Follow the skill at: `~/claude-devtools/skills/android-proguard-setup/SKILL.md`

**What it does:**
- Creates proguard-rules.pro with safe defaults
- Enables minification in build.gradle.kts
- Enables resource shrinking

**Verify before continuing:**
```bash
test -f app/proguard-rules.pro
grep "isMinifyEnabled = true" app/build.gradle.kts
```

---

### Step 3: Configure Signing

Follow the skill at: `~/claude-devtools/skills/android-signing-config/SKILL.md`

**What it does:**
- Adds signingConfigs to build.gradle.kts
- Creates gradle.properties.template
- Configures ~/.gradle/gradle.properties (with permission)
- Adds validation for missing signing config

**Verify before continuing:**
```bash
./gradlew assembleRelease
jarsigner -verify app/build/outputs/apk/release/app-release.apk
```

---

## Final Verification (MANDATORY)

After all three skills complete, verify the complete setup:

```bash
# 1. Clean build
./gradlew clean

# 2. Build release APK
./gradlew assembleRelease

# 3. Verify APK exists
ls -lh app/build/outputs/apk/release/app-release.apk

# 4. Verify ProGuard mapping generated
ls -lh app/build/outputs/mapping/release/mapping.txt

# 5. Verify signing
jarsigner -verify -verbose -certs app/build/outputs/apk/release/app-release.apk
```

**All checks must pass** before marking this skill as complete.

## Completion Criteria

Do NOT mark complete unless ALL are verified:

✅ **Keystores generated and secured**
  - [ ] production-release.jks exists in keystores/
  - [ ] local-dev-release.jks exists in keystores/
  - [ ] KEYSTORE_INFO.txt created with passwords
  - [ ] keystores/ added to .gitignore

✅ **ProGuard configured**
  - [ ] proguard-rules.pro exists with safe defaults
  - [ ] isMinifyEnabled = true in build.gradle.kts
  - [ ] isShrinkResources = true in build.gradle.kts

✅ **Signing configured**
  - [ ] signingConfigs.release exists in build.gradle.kts
  - [ ] Release buildType uses signingConfig
  - [ ] gradle.properties configured (local) OR environment variables set (CI)

✅ **MANDATORY: Build verification**
  - [ ] `./gradlew assembleDebug` succeeds
  - [ ] `./gradlew assembleRelease` succeeds
  - [ ] app/build/outputs/apk/release/app-release.apk exists
  - [ ] app/build/outputs/mapping/release/mapping.txt exists
  - [ ] `jarsigner -verify` confirms APK is signed correctly

## Summary Report

After completion, provide this summary:

```
✅ Android Release Build Setup Complete!

📦 Keystores Generated:
  Production: keystores/production-release.jks (CI/CD only)
  Local Dev: keystores/local-dev-release.jks (local testing)
  Credentials: keystores/KEYSTORE_INFO.txt

🔒 ProGuard/R8 Configuration:
  ✓ Minification enabled
  ✓ Resource shrinking enabled
  ✓ Safe default rules: app/proguard-rules.pro

⚙️  Build Configuration:
  ✓ Signing config added to app/build.gradle.kts
  ✓ Dual-source strategy (env vars + gradle.properties)
  ✓ Validation on release builds

📋 Next Steps:

  For Local Development:
    ./gradlew assembleRelease
    ./gradlew installRelease

  For CI/CD (GitHub Actions):
    Add GitHub Secrets (see KEYSTORE_INFO.txt):
      - SIGNING_KEY_STORE_BASE64
      - SIGNING_KEY_ALIAS
      - SIGNING_STORE_PASSWORD
      - SIGNING_KEY_PASSWORD

⚠️  CRITICAL REMINDERS:
  - NEVER commit keystores to git
  - NEVER use production keystore locally
  - ALWAYS back up production keystore securely
  - Loss of production keystore = cannot update app!
```

## Integration with Other Skills

This skill is prerequisite for:
- `android-e2e-testing-setup` - Tests release builds
- `android-release-validation` - Validates signed APK/AAB
- `android-playstore-publishing` - Uses keystore for CI/CD workflow
- `android-playstore-pipeline` - Orchestrates full setup

## Troubleshooting

If any skill fails:
1. Fix the specific issue in that skill
2. Re-run that skill until it completes
3. Continue with remaining skills
4. Run final verification

Common issues:
- **Keystore generation fails** → Install JDK
- **ProGuard breaks build** → Add keep rules
- **Signing fails** → Check gradle.properties paths

Overview

This skill automates a complete Android release build configuration by orchestrating keystore creation, ProGuard/R8 setup, and signing configuration. It prepares both CI/CD-safe production credentials and a local development keystore, enables minification and resource shrinking, and wires signing into your Gradle build.

How this skill works

The skill runs three ordered steps: generate keystores, create proguard rules and enable R8 options, then add signingConfigs and environment/gradle.properties support. It updates project files (.gitignore, build.gradle.kts, gradle.properties template) and produces verification artifacts like KEYSTORE_INFO.txt and mapping files. Final verification builds and signature checks confirm the release APK is minified and correctly signed.

When to use it

  • Preparing an Android project for production releases with CI/CD
  • Setting up a reproducible local dev signing workflow separate from production keys
  • Enabling ProGuard/R8 minification and resource shrinking for release builds
  • Onboarding a repository to follow a secure release signing process
  • Before configuring Play Store publishing pipelines

Best practices

  • Never commit keystores or KEYSTORE_INFO.txt to version control; add keystores/ to .gitignore
  • Keep production keystore offline and use CI secrets (base64) for automated signing
  • Verify mapping.txt is produced to enable crash deobfuscation
  • Use environment variables for CI and a gradle.properties.template for local setup
  • Back up the production keystore securely; loss prevents app updates

Example use cases

  • Generate production and local keystores and update build files in a Gradle/Kotlin DSL project
  • Enable R8 minification and resource shrinking with safe default proguard-rules.pro
  • Configure signingConfigs.release and make release builds work both locally and in CI
  • Prepare secrets and artifacts for GitHub Actions: SIGNING_KEY_STORE_BASE64 and passwords
  • Validate a final release by assembling, checking mapping files, and verifying jar signatures

FAQ

What must I verify before marking this setup complete?

Run clean and assembleRelease, confirm app-release.apk and mapping/release/mapping.txt exist, and run jarsigner -verify to ensure the APK is signed.

How should CI handle the production keystore securely?

Encode the keystore as base64, store it and passwords in CI secrets, and decode during pipeline runs; avoid storing raw keystore files in the repo.