capacitor-android-dex-optimization

Installation
SKILL.md

Capacitor Android: DEX Code Optimization

Enable R8 in a Capacitor Android app and add the keep rules a Capacitor app needs so that the release build passes the Google Play DEX code optimization requirement without crashing at startup.

The Android project that npx cap add android generates sets minifyEnabled false, so R8 never runs and Google Play measures close to 0% obfuscation, optimization and shrinking. From February 2027, Google Play requires at least 25% in each category for apps with more than 10 MB of DEX code. Play reads the numbers from the r8.json file inside the app bundle for apps built with AGP 8.10 or newer.

Prerequisites

Requirement Version
Capacitor 6+
Android Gradle Plugin 8.0+ (8.10+ for the r8.json check in Step 6)
JDK 17 for Capacitor 6 and 7, 21 for Capacitor 8
adb installed, with a device or emulator connected for Step 5

The project must be a Capacitor app (not a plugin) with an existing android/ directory.

Agent Behavior

Installs
55
GitHub Stars
54
First Seen
8 days ago