Yokan / rebuild
Course 1 8624561

13-release-checklist.md

.codex/skills/compose-kotlin-agent-skills/references/13-release-checklist.md

documentation / design asset309 lines
1# Release Checklist — Signing, R8, Baseline Profiles, Play Store23## Contents45- Signing config6- ProGuard/R8 rules7- Baseline profiles8- Release build config9- Play Store checklist1011## Signing Config1213### Generate Keystore1415```bash16keytool -genkeypair \17    -v \18    -keystore release.keystore \19    -alias release \20    -keyalg RSA \21    -keysize 2048 \22    -validity 10000 \23    -storepass <password> \24    -keypass <password>25```2627### Gradle Config (CI-safe)2829```kotlin30// build.gradle.kts (app)31android {32    signingConfigs {33        create("release") {34            storeFile = file(System.getenv("KEYSTORE_PATH") ?: "release.keystore")35            storePassword = System.getenv("KEYSTORE_PASSWORD") ?: ""36            keyAlias = System.getenv("KEY_ALIAS") ?: "release"37            keyPassword = System.getenv("KEY_PASSWORD") ?: ""38        }39    }40    buildTypes {41        release {42            isMinifyEnabled = true43            isShrinkResources = true44            proguardFiles(45                getDefaultProguardFile("proguard-android-optimize.txt"),46                "proguard-rules.pro"47            )48            signingConfig = signingConfigs.getByName("release")49        }50    }51}52```5354**Never commit keystore or passwords to git.** Use environment variables or GitHub Secrets.5556### GitHub Actions Secrets5758```yaml59# .github/workflows/release.yml60env:61  KEYSTORE_PATH: ${{ runner.temp }}/release.keystore62  KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}63  KEY_ALIAS: ${{ secrets.KEY_ALIAS }}64  KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}6566steps:67  - name: Decode keystore68    run: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > ${{ runner.temp }}/release.keystore69```7071## ProGuard/R8 Rules7273### What R8 Does74751. **Shrinking** — removes unused code762. **Obfuscation** — renames classes/methods to short names773. **Optimization** — inlines methods, removes dead branches7879### What Breaks Without Rules8081| Library | What breaks | Rule needed |82|---------|------------|-------------|83| **Kotlin serialization** | Serialized class names stripped | Keep `@Serializable` classes |84| **Room** | Entity/DAO reflection fails | Keep `@Entity`, `@Dao` |85| **Hilt** | Injection fails | Auto-handled by Hilt plugin |86| **Retrofit/Ktor** | DTO deserialization fails | Keep DTO classes |87| **ML Kit** | Model loading fails | Keep ML Kit classes |88| **Compose** | Generally fine | Compose compiler handles it |8990### proguard-rules.pro9192```proguard93# Kotlin Serialization94-keepattributes *Annotation*, InnerClasses95-dontnote kotlinx.serialization.AnnotationsKt96-keepclassmembers class kotlinx.serialization.json.** { *** Companion; }97-keepclasseswithmembers class kotlinx.serialization.json.** {98    kotlinx.serialization.KSerializer serializer(...);99}100-keep,includedescriptorclasses class com.example.app.data.dto.**$$serializer { *; }101-keepclassmembers class com.example.app.data.dto.** {102    *** Companion;103    *** serializer(...);104}105106# Room107-keep class * extends androidx.room.RoomDatabase108-keep @androidx.room.Entity class *109-dontwarn androidx.room.paging.**110111# Ktor112-keep class io.ktor.** { *; }113-dontwarn io.ktor.**114115# ML Kit116-keep class com.google.mlkit.** { *; }117-dontwarn com.google.mlkit.**118119# Keep enums used in serialization120-keepclassmembers enum * {121    public static **[] values();122    public static ** valueOf(java.lang.String);123}124```125126### Testing R8127128```bash129# Build release APK130./gradlew assembleRelease131132# Test release APK thoroughly — R8 bugs only appear in release builds133# Install on device and test ALL features134adb install app/build/outputs/apk/release/app-release.apk135```136137**Always test the release build.** Debug works ≠ Release works. R8 can strip code that debug builds keep.138139## Baseline Profiles140141See `10-performance.md` for generation. Here's the release integration:142143```kotlin144// build.gradle.kts (app)145dependencies {146    implementation("androidx.profileinstaller:profileinstaller:1.4.1")147    baselineProfile(project(":benchmark"))148}149150android {151    buildTypes {152        release {153            baselineProfile.automaticGenerationDuringBuild = true154        }155    }156}157```158159Verify in APK:160```bash161unzip -l app-release.apk | grep baseline162# Expected: assets/dexopt/baseline.prof163# Expected: assets/dexopt/baseline.profm164```165166## Release Build Config167168```kotlin169android {170    defaultConfig {171        applicationId = "com.example.app"172        versionCode = 12173        versionName = "1.2.0"174        targetSdk = 35175    }176177    buildTypes {178        release {179            isMinifyEnabled = true180            isShrinkResources = true181            proguardFiles(182                getDefaultProguardFile("proguard-android-optimize.txt"),183                "proguard-rules.pro"184            )185        }186        debug {187            isMinifyEnabled = false188            applicationIdSuffix = ".debug"189            versionNameSuffix = "-debug"190        }191    }192193    buildFeatures {194        buildConfig = true195    }196}197```198199### Version Code Strategy200201```202versionCode = major * 10000 + minor * 100 + patch203// 1.2.3 → 10203204// 2.0.0 → 20000205```206207Or auto-increment from git:208```kotlin209val versionCode = providers.exec {210    commandLine("git", "rev-list", "--count", "HEAD")211}.standardOutput.asText.get().trim().toInt()212```213214## Play Store Checklist215216### Before First Upload217218- [ ] App signing — enrolled in Play App Signing (Google manages key)219- [ ] Privacy policy URL — required for any app requesting permissions220- [ ] Content rating — complete questionnaire221- [ ] Target audience — declare age group222- [ ] Data safety form — declare what data you collect223224### Before Every Release225226- [ ] `versionCode` incremented (Play Store rejects same or lower)227- [ ] `versionName` updated for users228- [ ] Release build tested on physical device229- [ ] All features work with R8 enabled230- [ ] Baseline profile included in APK231- [ ] Crash-free in Firebase Crashlytics (if integrated)232- [ ] Screenshot updated if UI changed233- [ ] Release notes written (max 500 chars per language)234235### Accessibility Service (Special Review)236237If your app uses `AccessibilityService`:238239- [ ] Service description in XML matches actual usage240- [ ] Only requested event types are declared241- [ ] Prominent disclosure shown to user before enabling242- [ ] YouTube video demonstrating the accessibility feature243- [ ] Detailed justification in Play Console review notes244245**Play Store will reject** vague accessibility service descriptions. Be specific: "This service monitors which app is in the foreground to determine if a blocked app has been opened."246247### App Bundle vs APK248249```bash250# Always use App Bundle for Play Store251./gradlew bundleRelease252# Output: app/build/outputs/bundle/release/app-release.aab253254# APK only for sideloading or testing255./gradlew assembleRelease256```257258App Bundles are ~15% smaller than APKs. Play Store requires bundles for new apps.259260## CI/CD — GitHub Actions261262```yaml263name: Release Build264265on:266  push:267    tags: ['v*']268269jobs:270  build:271    runs-on: ubuntu-latest272    steps:273      - uses: actions/checkout@v4274275      - uses: actions/setup-java@v4276        with:277          distribution: 'temurin'278          java-version: '17'279280      - name: Setup Gradle281        uses: gradle/actions/setup-gradle@v4282283      - name: Decode keystore284        run: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > ${{ runner.temp }}/release.keystore285286      - name: Build release bundle287        env:288          KEYSTORE_PATH: ${{ runner.temp }}/release.keystore289          KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}290          KEY_ALIAS: ${{ secrets.KEY_ALIAS }}291          KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}292        run: ./gradlew bundleRelease293294      - name: Upload AAB295        uses: actions/upload-artifact@v4296        with:297          name: release-aab298          path: app/build/outputs/bundle/release/app-release.aab299```300301## Anti-Patterns302303- **Committing keystore to git** → anyone with repo access can sign as you304- **`isMinifyEnabled = false` in release** → APK 2-3x larger, all code visible305- **No R8 testing** → crashes in production that debug never catches306- **`fallbackToDestructiveMigration()` in release** → deletes all user data on schema change307- **Same `applicationId` for debug and release** → can't install both simultaneously for testing308- **Forgetting `isShrinkResources = true`** → unused drawables/layouts stay in APK309- **Manual version code management** → forgetting to increment rejects Play Store upload310

Search chapters, reference and source filenames.