Fixed
Status Update
Comments
em...@google.com <em...@google.com>
je...@google.com <je...@google.com>
ga...@google.com <ga...@google.com> #2
Thanks for reporting this issue. I've verified that it is fixed in AGP 8.2.0-alpha14 as there were some changes around composite build support in Gradle 8.x.
Change id: I019829a162008678bfefa120d26419555e028326
ka...@gmail.com <ka...@gmail.com> #3
Still is reproducible in AGP 8.2.2
ga...@google.com <ga...@google.com> #4
Using the example project from #1 (upgraded AGP to 8.2.2 and Gradle to 8.2) in Studio Jellyfish Canary 8 I was unable to reproduce the project.
Can you please share a Studio version that reproduces the issue for you or a new sample project?
ka...@gmail.com <ka...@gmail.com> #5
My bad.
In real project I still used com.android.tools.build:gradle:8.1.4
As only I have changed it to 8.2.2, all works fine :)
Thanks to the team for fix!
ga...@google.com <ga...@google.com> #6
Great, thanks for confirmation!
Description
DESCRIBE THE ISSUE IN DETAIL:
AGP failed during syncing project, where there is composite build (includeBuild) of project with, in order, another composite build (i.e. nested composite build).
STEPS TO REPRODUCE:
includeBuild("../lib1")
includeBuild("../lib2")
Full example is attached.
Studio Build: Android Studio Giraffe | 2022.3.1 Canary 11 (Build #AI-223.8836.35.2231.9848316, built on March 30, 2023)
Version of Gradle Plugin: 8.1.0-alpha11
Version of Gradle: 8.0
Version of Java: JetBrains Runtime version 17.0.6
OS: Windows 11
The cause of problem is
in com.android.build.gradle.internal.ide.v2.ModelBuilder
.Look into method
getBuildName()
. There is conditionit.projectDir == currentGradle.rootProject.projectDir
According to Gradle docs, nested composite build structure is flattened, i.e. all the included (and syb-included) projects have same root. See Gradle updated docs inhttps://github.com/gradle/gradle/pull/24469/files#diff-07fc669ece55f938ee36f360129142a0576f95381ffe9c7f737ce6fe69499993
So when executing on sub-included project (lib2) the condition above will be false, because
parentGradle
will beapp
instead oflib1
parentGradle.includedBuilds
will belib1
instead oflib2
As a result,
it.projectDir === lib1
, whencurrentGradle.rootProject.projectDir === lib2
So it is needed to fix
getBuildName
to solve the problem.