Android Gradle plugin 9.6 is a minor release that includes a variety of new features and improvements.
Compatibility
The maximum API level that Android Gradle plugin 9.6 supports is API level 37. Here is other compatibility info:
| Minimum version | Default version | Notes | |
|---|---|---|---|
| Gradle | 9.8.2 | 9.8.2 | 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.6.0-alpha05 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.
On-device code coverage for instrumented tests
AGP 9.6.0-alpha01 adds on-device code coverage for instrumented tests. Instead
of instrumenting your app's classes with JaCoCo at build time, AGP adds a
coverage agent to your test APK, and the agent instruments the classes on the
test device while your tests run. This removes the JaCoCo instrumentation step
from builds that have enableAndroidTestCoverage enabled, and keeps
coverage-tracking code out of your app's APK. You run the same
create{Variant}AndroidTestCoverageReport task, and AGP generates the HTML and
XML reports in the same location. On-device code coverage requires a debuggable
app and a device that runs Android 9 (API level 28) or higher.
AGP adds the coverage agent library, com.android.tools.test:coverage-agent,
with the same version as AGP. For more information, see View code coverage
reports (with on-device agent).
Test suites
AGP 9.6 adds the following updates for the testOptions.customSuites block:
- Access merged Android resources and run Robolectric tests on the JVM by
setting the
enableAndroidResourcesproperty in thehostJarblock. - Run
testApksuites incom.android.librarymodules, target build-managed device groups in thetargetDevicesproperty, filter tests with the--testsoption, and use automatic manifest runner configuration. - Customize Gradle
Testtasks per target with theAgpTestSuiteTarget.configureTestTasksmethod. - Collect code coverage with the
codeCoverageproperty for Compose screenshot suites through thetestOptions.customSuitesblock and for instrumented and mixed suites with the on-device coverage agent. - Match the
com.android.tools.androidtest:android-test-engineandandroid-test-engine-result-listenerdependency versions directly to the AGP version.
For more information, see Test suites in the Android Gradle plugin, Unit test suites, and Instrumented test suites.
Fixed issues
Android Gradle plugin 9.6.0-alpha03
| Fixed Issues | ||||
|---|---|---|---|---|
| Android Gradle Plugin |
|
|||
| Lint Integration |
|
|||
Android Gradle plugin 9.6.0-alpha02
| Fixed Issues | ||
|---|---|---|
| Android Gradle Plugin |
|
|
Android Gradle plugin 9.6.0-alpha01
| Fixed Issues | ||
|---|---|---|
| Android Gradle Plugin |
|
|
| Lint |
|
|