Android Gradle plugin 9.2 is a minor release that includes a variety of new features and improvements.
Compatibility
The maximum API level that Android Gradle plugin 9.2 supports is API level 36.1. Here is other compatibility info:
| Minimum version | Default version | Notes | |
|---|---|---|---|
| Gradle | 9.4.1 | 9.4.1 | To learn more, see updating Gradle. |
| SDK Build Tools | 36.0.0 | 36.0.0 | Install or configure SDK Build Tools. |
| NDK | N/A | 28.2.13676358 | Install or configure a different version of the NDK. |
| JDK | 17 | 17 | To learn more, see setting the JDK version. |
Unified coverage and test reports
AGP 9.2.0-alpha07 introduces tasks to generate HTML dashboards that consolidate test results and coverage from various test types (unit and instrumentation), modules, and build variants, providing a comprehensive overview in a single dashboard. For more information, see Generate unified code coverage reports and View unified test reports.
R8 changes
The following R8 changes are included in AGP 9.2.0.
Stricter -keepattributes semantics for keeping runtime invisible annotations
Runtime invisible annotations cannot be read at runtime. D8 therefore unconditionally removes runtime invisible annotations, with no option to change this.
For compatibility with ProGuard, R8 supports outputting runtime invisible
annotations. But when compiling to DEX, runtime invisible annotations should
generally never be retained. However, it's common practice to include the
convenient rule -keepattributes *Annotation* (either directly or indirectly
from consumer keep rules) for R8 to keep runtime visible annotations.
Unfortunately this also ends up keeping runtime invisible annotations.
To mitigate this problem and better match D8 behavior, -keepattributes
patterns with wildcards no longer match RuntimeInvisibleAnnotations,
RuntimeInvisibleParameterAnnotations, and RuntimeInvisibleTypeAnnotations.
As a result, runtime invisible annotations will only be kept if the attribute
name is mentioned explicitly without wildcards.
None of the following rules will now keep runtime invisible annotations:
-keepattributes *
-keepattributes *Annotation*
-keepattributes *Invisible*
To keep runtime invisible annotations, use the following rule:
-keepattributes RuntimeInvisibleAnnotations,
RuntimeInvisibleParameterAnnotations,
RuntimeInvisibleTypeAnnotations
Support for negated names in member rules
The configuration language has been extended so that you can now match on negated member name patterns.
For example, to match all methods that don't end in "ForTesting" use the following rule:
-keepclassmembers class com.example.MyClass {
*** !*ForTesting(...);
}
Member name patterns can also be negated in the precondition of -if
rules. If a negated member name pattern contains wildcards, such
wildcards cannot be back-referenced in the -if consequent rule.
Fixed issues
Android Gradle plugin 9.2.0-alpha04
| Fixed Issues | |||
|---|---|---|---|
| Android Gradle Plugin |
|
||
Android Gradle plugin 9.2.0-alpha03
| Fixed Issues | |||
|---|---|---|---|
| Android Gradle Plugin |
|
||
| Lint |
|
||
| Lint Integration |
|
||
Android Gradle plugin 9.2.0-alpha02
| Fixed Issues | ||||
|---|---|---|---|---|
| Android Gradle Plugin |
|
|||
| Lint Integration |
|
|||
Android Gradle plugin 9.2.0-alpha01
| Fixed Issues | |||||
|---|---|---|---|---|---|
| Android Gradle Plugin |
|
||||
| Lint |
|
||||