Status Update
Comments
al...@google.com <al...@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.
tn...@google.com <tn...@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.
al...@google.com <al...@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.
tn...@google.com <tn...@google.com> #7
BTW, what is the target release for this fix?
al...@google.com <al...@google.com> #8
For now, we've worked around this by adding this to our Kotlin convention plugin:
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
moduleName.set(path.removePrefix(":").replace(":", "_"))
}
}
au...@google.com <au...@google.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(":", "_"))
}
}
al...@google.com <al...@google.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(":", "_"))
}
pa...@google.com <pa...@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.
pa...@google.com <pa...@google.com>
pa...@google.com <pa...@google.com> #12
Alternatively you can give them unique names e.g.
kotlin {
compilerOptions {
moduleName.set(project.path)
}
}
applied to all projects
pa...@google.com <pa...@google.com> #13
We set the module to the dashified project gradle path. Kinda feel like this should be the default for the module merging issue in general
pa...@google.com <pa...@google.com>
an...@google.com <an...@google.com> #14
In my case, I had similar errors with MergeJavaResourcesTask
But in my case, errors were against for META-INF metadata
from
And I did set same workaround with
Description
Jetpack uses a lint check to prevent cross-group usage of the
@RequiresOptIn
annotation. The implementation is similar to@RestrictToDetector
's enforcement ofLIBRARY_GROUP
, but our check fails provisional checks on alternating runs even though they seem to be reporting as expected.We've logged some data to figure out what's going on when using
./gradlew :lint-checks:test --rerun-tasks
.For a failing run, we see:
The next run, however, passes:
The next run fails, and so on.