- Home
- Skills
- Hitoshura25
- Claude Devtools
- Android Proguard Setup
android-proguard-setup_skill
- Shell
1
GitHub Stars
1
Bundled Files
3 weeks ago
Catalog Refreshed
2 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstart where the catalogue uses aiagentskills.
npx veilstart add skill hitoshura25/claude-devtools --skill android-proguard-setup- SKILL.md6.2 KB
Overview
This skill configures ProGuard/R8 for Android release builds with safe default rules to enable code minification and resource shrinking. It creates a conservative proguard-rules.pro, enables isMinifyEnabled and isShrinkResources in app/build.gradle.kts, and verifies the setup with simple checks. The goal is a predictable, safer release build while preserving runtime behavior for common Android and Kotlin patterns.
How this skill works
The skill creates or updates app/proguard-rules.pro with conservative keep rules for data classes, Parcelables, custom views, native methods, and common libraries. It updates app/build.gradle.kts to enable minification and resource shrinking for the release build, preserving any existing proguardFiles where possible. Finally it runs small verification commands to confirm the rules file and Gradle flags are present.
When to use it
- Preparing an Android app for production release builds
- Reducing APK size while avoiding runtime crashes from aggressive obfuscation
- Adding baseline ProGuard rules for Kotlin, Parcelables, custom views, or native methods
- Ensuring test APKs remain unminified when needed for instrumentation tests
- Onboarding teams that lack a ProGuard/R8 configuration
Best practices
- Back up existing proguard-rules.pro and ask whether to replace, append, or keep existing rules
- Enable minification only for release builds; keep debug builds unobfuscated for easier debugging
- Verify app functionality (especially reflection and serialization) with a minified release build before distribution
- Add library-specific keep rules (Retrofit, Gson, Room, Kotlin Serialization) as-needed rather than globally
- Use a separate test ProGuard file to keep test APKs unminified when required for signing or instrumentation
Example use cases
- Add safe default ProGuard rules to a new Android project using Kotlin DSL
- Migrate an existing project to enable isMinifyEnabled and isShrinkResources without losing existing proguardFiles entries
- Troubleshoot crashes caused by missing keep rules by iteratively appending rules to proguard-rules.pro
- Configure release and test ProGuard behavior so test APKs remain readable while app APK is minified
- Apply library-specific rules when integrating Retrofit, Gson, Room, or Health Connect
FAQ
A failing release build usually means ProGuard removed needed classes. Inspect the ProGuard/R8 stacktrace and add targeted -keep rules to proguard-rules.pro for the missing classes or reflection targets.
Should I always replace an existing proguard-rules.pro?
No. Offer options: replace with safe defaults, append the safe defaults, or keep existing rules. Appending is safest to avoid losing project-specific rules.