Android Gradle plugin 9.6.0

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.6.0 9.6.0 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.

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).

Fixed issues

Android Gradle plugin 9.6.0-alpha01

Fixed Issues
Android Gradle Plugin
shrinkresources does not work with library apks due to recent aapt2 change
Lint
Lint ThreadConstraint partial results are not deterministic across JVMs, which breaks build cache for lintAnalyze