Files
capod/.claude/rules/screenshots.md
T

2.7 KiB

Play Store Screenshot Pipeline

Overview

Localized screenshots are generated using Compose Preview Screenshot Testing (alpha), rendered offline (no device needed), and sorted into fastlane metadata directories for Play Store upload.

Pipeline

ScreenshotContent.kt (mock data + composables)
    → PlayStoreScreenshots.kt (@PreviewTest entry points)
    → PlayStoreLocales.kt (multi-preview locale annotations, auto-generated per batch)
    → generate_screenshots.sh (batched Gradle runs to avoid OOM)
    → copy_screenshots.sh (sort PNGs into fastlane locale dirs)
    → fastlane/metadata/android/{locale}/images/phoneScreenshots/

Key Files

File Purpose
app/src/debug/java/.../screenshots/ScreenshotContent.kt Mock data composables for each screen (8 screens)
app/src/screenshotTest/kotlin/.../screenshots/PlayStoreScreenshots.kt @PreviewTest functions that wire content to locale annotations
app/src/screenshotTest/kotlin/.../screenshots/PlayStoreLocales.kt Multi-preview annotations (auto-generated by batch script)
fastlane/generate_screenshots.sh Batched generation across 68 locales
fastlane/copy_screenshots.sh Copies rendered PNGs into fastlane structure

Commands

# Full run — all 68 locales, ~12 batches, ~7 minutes
./fastlane/generate_screenshots.sh

# Smoke test — 6 locales (en, de, ja, ar, zh-CN, pt-BR), single batch
./fastlane/generate_screenshots.sh --smoke

# Copy into fastlane directories (run after generate)
./fastlane/copy_screenshots.sh

# Clean copy (removes old screenshots first)
./fastlane/copy_screenshots.sh --clean

Adding a New Screenshot

  1. Add a composable content function in ScreenshotContent.kt (e.g. NewScreenContent())
  2. Add a @PreviewTest function in PlayStoreScreenshots.kt that calls it
  3. Add the function name → filename mapping in copy_screenshots.sh SCREEN_MAP
  4. Update the expected count in generate_screenshots.sh (composables per locale)
  5. Run the full pipeline: generate_screenshots.sh then copy_screenshots.sh

After UI Changes

When modifying a screen that appears in screenshots (check ScreenshotContent.kt), regenerate:

./fastlane/generate_screenshots.sh
./fastlane/copy_screenshots.sh --clean

Technical Notes

  • Batch size defaults to 2 locales (16 renders) to avoid layoutlib memory leak (~10MB/image)
  • Gradle daemon is stopped between batches to release memory
  • PlayStoreLocales.kt is temporarily rewritten per batch and restored via trap
  • Device spec: 1080x2400px @ 428 DPI (Pixel-class phone)
  • Uses com.android.compose.screenshot plugin v0.0.1-alpha13
  • Output: app/src/screenshotTestGplayDebug/reference/