Status Update
Comments
ga...@google.com <ga...@google.com>
ga...@google.com <ga...@google.com> #2
Thanks for reporting, would you be able to provide a reproducible case for when this incremental error occurs? The task for merging java resources has multiple incremental inputs depending on where the java resource originates - providing a sample project where this issue can be triggered will help the team narrow what task input is impacted. A longer stacktrace of the issue from #1 might also be useful.
ji...@google.com <ji...@google.com>
je...@google.com <je...@google.com>
ga...@google.com <ga...@google.com> #3
ga...@google.com <ga...@google.com> #4
Thanks for the additional information. I have refactored the Java Resource merging incremental handling to better handle source file path roots - so hopefully this is enough to eliminate the possibility of collisions between java resources. However, it would be great to test these changes resolve your issue. My current assumption is that the issue occurs when there is a library structure where there are two modules of the same name nested within two differently named modules such as:
app
foo_lib
foo
bar_lib
foo
Could you confirm that this setup is similar in your project or if not, can you please provide your project structure or even a project if possible?
bi...@google.com <bi...@google.com>
ga...@google.com <ga...@google.com> #5
Yes, our setup looks like this:
:features
:feature1
:public
:impl
:feature2
:public
:impl
...
The modules mentioned in the error would always be one of these impl
or public
modules.
Unfortunately I cannot share our project and even if I could, I don't know how to replicate the issue.
I will say though that since upgrading to the latest AGP 8.2 alpha I have not seen the issue so it's possible that it's already been fixed as a part of another change.
bi...@google.com <bi...@google.com> #6
Oops, spoke too soon. It just happened.
Once it happens ever run will trigger it so if you need me to log or try something let me know. Removing the app level build directory fixes the issue.
an...@google.com <an...@google.com> #7
BTW, what is the target release for this fix?
ab...@gmail.com <ab...@gmail.com> #8
yo...@gmail.com <yo...@gmail.com> #9
Thanks for sharing the workaround. I needed to slightly adapt it to work for us, otherwise kapt and ksp would fail because they'd expect different names for internal
symbols.
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask.class).configureEach {
if (!name.containsIgnoreCase("ksp") && !name.containsIgnoreCase("kapt")) {
compilerOptions {
moduleName.set(path.substring(1).replace(":", "_"))
}
}
yo...@gmail.com <yo...@gmail.com> #10
Actually, I found a better way to solve this. The default module name is based on the base plugin's archivesName
property. So you can do this instead:
base {
archivesName.set(path.removePrefix(":").replace(":", "_"))
}
bi...@google.com <bi...@google.com> #11
It seems AGP is not correctly excluding kotlin_module files during java resource merging, so we'd expect a collision - although this error message isn't clear.
Until we release we have a fix for the issue, a workaround may be to add packagingOptions { exclude 'META-INF/*.kotlin_module' }
to the build.gradle conflicting libraries, so AGP doesn't attempt to merge them.
bi...@google.com <bi...@google.com> #12
Alternatively you can give them unique names e.g.
kotlin {
compilerOptions {
moduleName.set(project.path)
}
}
applied to all projects
Description
Use new Gradle 6.8 APIs that allow aligning configurations. The new APIs should use much less memory, compared to how we are doing it now (resolving runtime and then pinning compile versions to those).