Update android.gradle.plugin to v9 (major)#788
Conversation
Pull Request Review: Update Android Gradle Plugin to v9.0.0OverviewThis PR updates the Android Gradle Plugin (AGP) from 8.13.2 to 9.0.0, which is a major version upgrade with significant breaking changes. ✅ Positive Aspects
|
| Property | Old Default | New Default | Impact |
|---|---|---|---|
android.enableAppCompileTimeRClass |
false | true | App R classes now non-final (like libraries) |
android.sdk.defaultTargetSdkToCompileSdkIfUnset |
false | true | targetSdk defaults to compileSdk if unset |
android.onlyEnableUnitTestForTheTestedBuildType |
false | true | Unit tests only for debug by default |
android.proguard.failOnMissingFiles |
false | true | Build fails on missing ProGuard files |
Status: Your project explicitly sets targetSdk (35) in libs.versions.toml:14, which is good.
5. Removed/Deprecated Features
dexOptionsremoved (D8 replaces dx)AndroidSourceSet.jniremovedproguard-android.txtno longer supported (useproguard-android-optimize.txt)
🔍 Code Quality Observations
Build Configuration
- Good: Using convention plugins for build configuration consistency
- Good: Version catalog properly configured
- Good: Java 17 is compatible with AGP 9.0
Areas to Verify
-
ProGuard Configuration (
app/build.gradle.kts:23):proguardFiles("proguard-android.txt", "proguard-rules.pro")
⚠️ proguard-android.txtis deprecated in AGP 9.0. Should useproguard-android-optimize.txt -
buildConfig Feature: Explicitly enabled in both app and library plugins - good, as this is required in AGP 9.0
-
Gradle Configuration Cache: Already enabled in
gradle.properties:14- excellent for build performance
🔒 Security Considerations
- API Token Exposure: The codebase stores API token in
gradle.properties:23in plain text. While acknowledged as acceptable for this sample project, ensure this pattern isn't copied to production projects.
🧪 Test Coverage
Observation: The project has comprehensive test infrastructure:
- JUnit5 configured
- Mockk, Kluent for testing
- Espresso for UI tests
- Konsist for architecture tests
Concern: All test CI checks are failing. Need to verify:
- Are tests failing due to AGP compatibility issues?
- Are tests themselves still valid with AGP 9.0 changes?
🚀 Performance Considerations
AGP 9.0 includes several performance improvements:
- ✅ Better configuration cache support (already enabled in this project)
- ✅ Improved incremental compilation
- ✅ Faster R8 optimization
📋 Recommendations
Immediate Actions (Before Merge)
- Fix CI Build Failures: Review build logs and address all failing checks
- Verify Kotlin Plugin Configuration: Decide on built-in Kotlin vs. explicit plugin
- Update ProGuard Reference: Change
proguard-android.txttoproguard-android-optimize.txtif used - Test Migration Path:
- Consider adding temporary opt-out properties to
gradle.propertiesif quick fix needed:android.newDsl=false android.builtInKotlin=false
- Then create follow-up tasks to properly migrate
- Consider adding temporary opt-out properties to
Follow-up Tasks
- Audit Variant API Usage: Review all convention plugins for deprecated variant APIs
- Review AGP Upgrade Assistant: Consider running AGP's built-in upgrade assistant
- Update Documentation: Document any migration steps or opt-outs applied
- Performance Benchmarking: Measure build times before/after to verify improvements
Testing Checklist
- All unit tests pass
- All instrumented tests pass
- Build succeeds for debug variant
- Build succeeds for release variant
- Lint checks pass
- Static analysis (detekt, konsist) passes
- Code formatting (spotless) passes
- App launches successfully
- Key features work as expected
📚 Resources
Summary
This is a significant upgrade that requires careful testing and likely some code changes. The PR should not be merged until all CI failures are resolved. The failures likely indicate compatibility issues that need addressing through either code migration or temporary opt-outs while planning proper migration.
Consider whether the team is ready for this major upgrade or if it should be deferred until time can be allocated for proper migration work.
2d9b9e4 to
942d046
Compare
942d046 to
3fcddf3
Compare
This PR contains the following updates:
8.13.2→9.0.08.13.2→9.0.08.13.2→9.0.0Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR was generated by Mend Renovate. View the repository job log.