Android Gradle Plugin 8.2.0 (Nov 2023)

Android Gradle plugin 8.2.0 is a major release that includes a variety of new features and improvements.

Compatibility

The maximum API level that Android Gradle plugin 8.2 supports is API level 34. Here is other compatibility info:

Minimum version Default version Notes
Gradle 8.2 8.2 To learn more, see updating Gradle.
SDK Build Tools 34.0.0 34.0.0 Install or configure SDK Build Tools.
NDK N/A 25.1.8937393 Install or configure a different version of the NDK.
JDK 17 17 To learn more, see setting the JDK version.

New macro to specify JDK path

#GRADLE_LOCAL_JAVA_HOME is a new macro that you can use to specify the JDK path. This makes it safer and easier to specify the Java home path used for the Gradle daemon (background process) execution for your project. The path selection is stored in the java.home field in the .gradle/config.properties file. Set this field through Gradle JDK settings in Android Studio: File (or Android Studio on macOS) > Settings > Build, Execution, Deployment > Build Tools > Gradle.

New projects will use #GRADLE_LOCAL_JAVA_HOME by default. Existing projects will automatically be migrated to the new macro after a successful sync unless you're already using a macro like #JAVA_HOME.

The main benefits of the new macro are as follows:

  • You can manually modify the JDK path to trigger sync without opening your project first.
  • Fewer errors related to incompatible Gradle and project JDK versions since there is a single source of truth for your Gradle JDK selection.

Fixed issues

Android Gradle plugin 8.2.0

Fixed Issues
Android Gradle Plugin
Custom source types should create multi-flavor sourcesets
SDK version check does not handle users of SDK extensions
DependenciesInfoBuilder needs API update + doc
DexingNoClasspathTransform (minSdk >= 24) with Java 11 target fails due to missing nest members
DslExtension.Builder.extendProjectWith() not working as described in Groovy
Add VariantSelector.withFlavor API that doesn't use kotlin.Pair
AndroidLintAnalysisTask (:lintAnalyzeExternalRelease) has a cache miss because `proguard.txt` has changed
App merged manifest contains extractNativeLibs and useEmbeddedDex attributes from dependencies
AIDL fails with build-tools 33.0.0
AGP: Expose path to AIDL tool and framework AIDL file as public API
Request: let the IDE offer a fix for "PermittedSubclasses requires ASM9"
Target bytecode 17 when compiling AGP
Remove VariantManager.getModifiedName
AndroidTest.packaging.jniLibs.keepDebugSymbols doesn't affect androidTest packaging
GMD instrumentation test tasks hang and upon retrying start failing
generateLocaleConfig in agp 8.1.0 uses non-deterministic ordering, breaking reproducible builds
ProcessApplicationManifest.navigationJsons has files with absolute paths
Accessing GradleBuildProject.Builder through AnalyticsConfiguratorService is not allowed after AnalyticsService is created
AndroidTest.packaging.jniLibs.keepDebugSymbols doesn't affect androidTest packaging
Compilation allowed for illegal color values
Incorrect "ReplaceWith" for VariantBuilder
Gradle 8.1 breaks configuration caching due to .gradle/.android/analytics.settings
Deprecation messages doesn't use `ReplaceWith`
Expose a way to get the default NDK version
Android Gradle plugin requires Java 17 to run.
ASM Transform and toAppend() incompatibility
Fix LintErrors when running lint with K2 UAST via Gradle on a KMP project
Support for Variant level missingDimensionStrategy, and possibly build type/flavor matchingFallback
`android.injected.studio.version` was removed in Android Studio Giraffe
Add ability to disable AndroidXDependencyCheck
generateLocaleConfig in agp 8.1.0 uses non-deterministic ordering, breaking reproducible builds
Advertise R8 / D8 version requirements in AAR metadata (e.g. for coreLibraryDesugaring and new API out-of-lining)
Sync warning: "GradleBuildProject.Builder should not be accessed through AnalyticsConfiguratorService after AnalyticsService is created"
Update to Gradle 8.2 milestone or RC
Cannot access 'java.lang.Comparable'
androidResources is not available in the android library module
Execution failed for task ':app:mergeReleaseClasses' after Updating AGP from 8.0.2 to 8.1.0
Gradle 8.1 breaks configuration caching due to .gradle/.android/analytics.settings
[AGP 8.1.0] ./gradlew test fails with "Unable to find manifest output" if both splits.abi.isEnable and testOptions.unitTests.isIncludeAndroidResources are true
Android Studio Giraffe does not respect versionCodeOverride with AGP 8.1
AGP 8.1.0 uninstalls app after running instrumented tests - 7.4.2 does not
Tranforming an APK leads to a error with ListingFileRedirectTask
HEDGEHOG REGRESSION: Run button is delayed by a few seconds (Creating spec)
Dexer (D8)
Enable native record and sealed classes when dexing for min-api 34 and above
Lint
Instantiated lint check does not handle AppComponentFactory well
Lint 8.2.0 alphas still do not support top-level function imports in kotlin
Add an option to not include line and column numbers in lint baseline
Add an option to not include line and column numbers in lint baseline
Lint tests do not support Java 17 language features
Bumblebee 2021.1.1 Patch 1 is saying an old version (20030203.000550) of commons-io is newer than 2.11.0.
Lint 8.2.0 alphas still do not support top-level function imports in kotlin
Bumblebee 2021.1.1 Patch 1 is saying an old version (20030203.000550) of commons-io is newer than 2.11.0.
Android Studio improperly marks specified version as out-of-date.
Lint ignores UseValueOf issue when using K2 UAST
Unexpected issues from another project flagged by Android Lint
Android Lint fails on a KMP library with `property 'variantInputs.name' doesn't have a configured value.`
Lint Integration
DuplicatePlatformClasses lint error from testImplementation dependency
Shrinker (R8)
java.lang.VerifyError: Verifier rejected class
Build gets stuck on :minifyReleaseWithR8 when using Apache POI library
Kotlin 1.9 causes Kotlin lambdas to be destroyed by R8 if nullchecks are stripped

Android Gradle plugin 8.2.1

Fixed Issues
Android Gradle Plugin
Do not run dexing task on subprojects' classes when they are already dex'd through artifact transforms
Android Gradle Plugin failed with JavaVersion.VERSION_11 and OpenJDK 21 ea
Dexer (D8)
Desugar records for Android U
Shrinker (R8)
R8 generates broken dex resulting in class cast exception at runtime
R8 causing interface change to inaccessible interface
R8 Flurry SDK crash with AGP 8.2.0
Android - R8 causes subclass of LinearLayoutManager to crash
ClassCastException in R8 when repackaging is on and shrinking, obfuscation and optimization is turned off
R8 stuck in BridgeAnalyzer.analyzeMethod
R8 v8.2.33, "java.lang.VerifyError: Bad type on operand stack" runtime crash after upgrade

Android Gradle plugin 8.2.2

Fixed Issues
Android Gradle Plugin
Unable to set JaCoCo version in AGP 8.2.0
Dexer (D8)
[desugared library] Desugared library version 2.1 is not compatible with previous versions of R8
Optimizations running even just with D8?
Shrinker (R8)
[R8 8.3.21] R8 8.3.21 is 1.57MB larger than R8 8.1.56
class.getInterfaces() return empty