-
Notifications
You must be signed in to change notification settings - Fork 47
feat: enable R8 minification and upload ReTrace mapping files #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Enable minifyEnabled and shrinkResources for release builds - Update ProGuard rules with comprehensive library support - Add rules for Dagger2, ButterKnife, RxJava2, Fruit, and other libraries - Keep essential classes (BuildConfig, R, data models) but allow code obfuscation - Use proguard-android-optimize.txt for better optimization This will: - Generate mapping.txt file for crash deobfuscation - Reduce APK/AAB size through code shrinking - Improve app security through code obfuscation - Enable upload of ReTrace mapping files to Google Play Console 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enables R8 minification and resource shrinking for release builds, which was previously disabled due to crashes. The change includes comprehensive ProGuard rules to properly handle obfuscation while preserving essential classes and functionality.
- Enable R8 minification and resource shrinking for release builds
- Add extensive ProGuard rules for all project dependencies (Dagger 2, ButterKnife, RxJava2, etc.)
- Configure proper obfuscation while preserving critical Android components and data models
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| app/build.gradle | Enable minification, resource shrinking, and switch to optimized ProGuard configuration |
| app/proguard-rules.pro | Add comprehensive ProGuard rules for all project dependencies and Android components |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| -keep class io.reactivex.** { *; } | ||
| -keep interface io.reactivex.** { *; } |
Copilot
AI
Sep 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These broad RxJava2 rules conflict with the existing specific RxJava3 rules (lines 134-136) and are overly permissive. The existing rules already handle RxJava properly with selective obfuscation. Consider removing these duplicate rules or being more specific about which RxJava2 classes need preservation.
| -keep class io.reactivex.** { *; } | |
| -keep interface io.reactivex.** { *; } | |
| -keep,allowobfuscation,allowshrinking class io.reactivex.Flowable | |
| -keep,allowobfuscation,allowshrinking class io.reactivex.Maybe | |
| -keep,allowobfuscation,allowshrinking class io.reactivex.Observable | |
| -keep,allowobfuscation,allowshrinking class io.reactivex.Single |
|
|
||
| # Dagger 2 rules | ||
| -dontwarn com.google.errorprone.annotations.** | ||
| -keep class dagger.** { *; } |
Copilot
AI
Sep 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rule is overly broad and prevents any obfuscation of Dagger classes. Consider using more specific rules that only keep the essential Dagger classes while allowing others to be obfuscated, such as -keep class dagger.Module and -keep class dagger.Component only.
| -keep class dagger.** { *; } |
| -keep @javax.inject.Inject class * { *; } | ||
|
|
||
| # ButterKnife rules | ||
| -keep class butterknife.** { *; } |
Copilot
AI
Sep 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rule is overly broad for ButterKnife. The subsequent specific rules (lines 159-165) should be sufficient to handle ButterKnife's annotation processing. Consider removing this blanket rule to allow better obfuscation of ButterKnife internals.
| -keep class butterknife.** { *; } |
| } | ||
|
|
||
| # Custom Fruit HTML parsing library | ||
| -keep class me.ghui.fruit.** { *; } |
Copilot
AI
Sep 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rule prevents all obfuscation of the Fruit library. The annotation-specific rules (lines 170-176) should be sufficient for proper functionality. Consider removing this blanket rule to allow obfuscation of non-essential Fruit classes.
| -keep class me.ghui.fruit.** { *; } |
Summary
minifyEnabled true) and resource shrinking for release buildsChanges Made
Build Configuration (
app/build.gradle)minifyEnabled true(wasfalse)shrinkResources truefor additional size reductionproguard-android-optimize.txtfor better optimizationProGuard Rules (
app/proguard-rules.pro)network.bean.**) for JSON parsingBenefits
🎯 ReTrace Mapping Files: Enables crash deobfuscation in Google Play Console
📦 Smaller APK Size: Code and resource shrinking reduces app size
🔒 Enhanced Security: Code obfuscation makes reverse engineering harder
🚀 Better Performance: R8 optimizations can improve runtime performance
Testing
mapping.txt,seeds.txt,usage.txtValidation Steps
Once merged, the next release will:
🤖 Generated with Claude Code