Status Update
Comments
sg...@google.com <sg...@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.
cl...@google.com <cl...@google.com> #3
Unfortunately I cannot reproduce it consistently. In fact I don't even know what triggers it (it seems to be some combination of changes).
Like I mentioned above, my hunch is that this is due to having several modules with the same name (impl
). The resource in question (impl_debug.kotlin_module
) contains the name of the Gradle module and it likely means that there will be conflicts since there are several modules with the same name.
The stack trace looks like this:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:mergeDebugJavaResource'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:149)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:147)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:135)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:74)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:42)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:337)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:324)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:317)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:303)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:463)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:380)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:49)
Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
at org.gradle.workers.internal.DefaultWorkerExecutor$WorkItemExecution.waitForCompletion(DefaultWorkerExecutor.java:283)
at org.gradle.internal.work.DefaultAsyncWorkTracker.lambda$waitForItemsAndGatherFailures$2(DefaultAsyncWorkTracker.java:130)
at org.gradle.internal.Factories$1.create(Factories.java:31)
at org.gradle.internal.work.DefaultWorkerLeaseService.withoutLocks(DefaultWorkerLeaseService.java:321)
at org.gradle.internal.work.DefaultWorkerLeaseService.withoutLocks(DefaultWorkerLeaseService.java:304)
at org.gradle.internal.work.DefaultWorkerLeaseService.withoutLock(DefaultWorkerLeaseService.java:309)
at org.gradle.internal.work.DefaultAsyncWorkTracker.waitForItemsAndGatherFailures(DefaultAsyncWorkTracker.java:126)
at org.gradle.internal.work.DefaultAsyncWorkTracker.waitForItemsAndGatherFailures(DefaultAsyncWorkTracker.java:92)
at org.gradle.internal.work.DefaultAsyncWorkTracker.waitForAll(DefaultAsyncWorkTracker.java:78)
at org.gradle.internal.work.DefaultAsyncWorkTracker.waitForCompletion(DefaultAsyncWorkTracker.java:66)
at org.gradle.api.internal.tasks.execution.TaskExecution$3.run(TaskExecution.java:250)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
at org.gradle.api.internal.tasks.execution.TaskExecution.executeAction(TaskExecution.java:227)
at org.gradle.api.internal.tasks.execution.TaskExecution.executeActions(TaskExecution.java:210)
at org.gradle.api.internal.tasks.execution.TaskExecution.executeWithPreviousOutputFiles(TaskExecution.java:193)
at org.gradle.api.internal.tasks.execution.TaskExecution.execute(TaskExecution.java:166)
at org.gradle.internal.execution.steps.ExecuteStep.executeInternal(ExecuteStep.java:105)
at org.gradle.internal.execution.steps.ExecuteStep.access$000(ExecuteStep.java:44)
at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:59)
at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:56)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:56)
at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:44)
at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:67)
at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:37)
at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:41)
at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:74)
at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:55)
at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:50)
at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:28)
at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.executeDelegateBroadcastingChanges(CaptureStateAfterExecutionStep.java:100)
at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:72)
at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:50)
at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:40)
at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:29)
at org.gradle.internal.execution.steps.BuildCacheStep.executeWithoutCache(BuildCacheStep.java:166)
at org.gradle.internal.execution.steps.BuildCacheStep.lambda$execute$1(BuildCacheStep.java:70)
at org.gradle.internal.Either$Right.fold(Either.java:175)
at org.gradle.internal.execution.caching.CachingState.fold(CachingState.java:59)
at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:68)
at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:46)
at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:36)
at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:25)
at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:36)
at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:22)
at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:91)
at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$2(SkipUpToDateStep.java:55)
at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55)
at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:37)
at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:65)
at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:36)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:37)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:27)
at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:76)
at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:37)
at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:94)
at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:49)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:71)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:45)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.executeWithNonEmptySources(SkipEmptyWorkStep.java:177)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:81)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:53)
at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:32)
at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:21)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)
at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:36)
at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:23)
at org.gradle.internal.execution.steps.CleanupStaleOutputsStep.execute(CleanupStaleOutputsStep.java:75)
at org.gradle.internal.execution.steps.CleanupStaleOutputsStep.execute(CleanupStaleOutputsStep.java:41)
at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:32)
at org.gradle.api.internal.tasks.execution.TaskExecution$4.withWorkspace(TaskExecution.java:287)
at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30)
at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:21)
at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37)
at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27)
at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:47)
at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:34)
at org.gradle.internal.execution.impl.DefaultExecutionEngine$1.execute(DefaultExecutionEngine.java:64)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:146)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:135)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:74)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:42)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:337)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:324)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:317)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:303)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:463)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:380)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:49)
Caused by: java.lang.IllegalStateException: Unexpected combination of states CHANGED, REMOVED for file /path/to/module/build/intermediates/java_res/debug/out/META-INF/impl_debug.kotlin_module
at com.android.build.gradle.internal.tasks.IncrementalFileMergerTaskUtils.collectChanges(IncrementalFileMergerTaskUtils.kt:275)
at com.android.build.gradle.internal.tasks.IncrementalFileMergerTaskUtils.toInputs(IncrementalFileMergerTaskUtils.kt:229)
at com.android.build.gradle.internal.tasks.MergeJavaResWorkAction.run(MergeJavaResWorkAction.kt:68)
at com.android.build.gradle.internal.profile.ProfileAwareWorkAction.execute(ProfileAwareWorkAction.kt:74)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:66)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:62)
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:100)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.lambda$execute$0(NoIsolationWorkerFactory.java:62)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:59)
at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$0(DefaultWorkerExecutor.java:169)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:187)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.access$700(DefaultConditionalExecutionQueue.java:120)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner$1.run(DefaultConditionalExecutionQueue.java:162)
at org.gradle.internal.Factories$1.create(Factories.java:31)
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:249)
at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:109)
at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:114)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:157)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:126)
... 2 more
sk...@gmail.com <sk...@gmail.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?
sk...@gmail.com <sk...@gmail.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.
sk...@gmail.com <sk...@gmail.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.
cl...@google.com <cl...@google.com> #7
BTW, what is the target release for this fix?
sk...@gmail.com <sk...@gmail.com> #8 Restricted
el...@gmail.com <el...@gmail.com> #9
sk...@gmail.com <sk...@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(":", "_"))
}
sk...@gmail.com <sk...@gmail.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.
cl...@google.com <cl...@google.com> #12
Alternatively you can give them unique names e.g.
kotlin {
compilerOptions {
moduleName.set(project.path)
}
}
applied to all projects
cl...@google.com <cl...@google.com>
ch...@google.com <ch...@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
cl...@google.com <cl...@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
sk...@gmail.com <sk...@gmail.com> #15
I also had an error from Google AutoService
and packagingOptions { exclude 'META-INF/*.kotlin_module' }
removes the error in next build but it does not look correct solution. Can someone help me to fix this issue. For my case the error is for some debug source code which we generate using Google AutoService
. Should I exclude
those files or use pickFirst
for them?
sk...@gmail.com <sk...@gmail.com> #16
sk...@gmail.com <sk...@gmail.com> #17
I have same issue again after
I'm not sure, but I'm guessing that error was raised again after applied AGP 8.2
il...@gmail.com <il...@gmail.com> #18
In my case,
module A
and module B
have implementations of interface Xxx
which can be loaded by AutoService.
and MergeJavaResourcesTask
was failed of app C
while merge META-INF/services/Xxx
from module A
and module B
cl...@google.com <cl...@google.com> #19
I had previously applied the workaround from #10 to our build, however it caused packaging issues that manifested as runtime crashes. I'll be taking a second look at the workaround to see if I can fix our previous issues with it since we are starting to see this problem happen a lot more frequently. An issue with Anvil has been causing our developers to use --rerun
and --rerun-tasks
more frequently than usual, which masks the issue here. With the latest beta release of anvil, those options are no longer needed and this bug pops up a lot more frequently. We are using AGP 8.2.2 currently
el...@gmail.com <el...@gmail.com> #20
With the latest beta release of anvil, those options are no longer needed and this bug pops up a lot more frequently.
It doesn't seem like the latest beta has resolved these issues :/
sk...@gmail.com <sk...@gmail.com> #21
Have been having the same issue in recent builds, rm -rf app/build
is what helped in my case.
sk...@gmail.com <sk...@gmail.com> #22
I've managed to get what looks like a reliable reproduction case for this.
sk...@gmail.com <sk...@gmail.com> #23
This is mitigated in 22ea772c902a9891a6023ed1ebdc832871775ba6
but I am suspicious there are other lurking issues by inspection and from
sk...@gmail.com <sk...@gmail.com> #24
Filed
pu...@gmail.com <pu...@gmail.com> #25
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Jellyfish | 2023.3.1 Canary 12
- Android Gradle Plugin 8.4.0-alpha12
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
cl...@google.com <cl...@google.com> #26
AGP 8.3 final version was released at today.
Could this fix be applied to AGP 8.3.x patch version?
Or is there another solution that can alleviate this issue?
pu...@gmail.com <pu...@gmail.com> #27
Re merge
or pickFirst
in packagingOptions
?
pu...@gmail.com <pu...@gmail.com> #28
No, we have some exclude
rules but don't use either merge
or pickFirst
pu...@gmail.com <pu...@gmail.com> #29
The fixes for this issue are now also available in:
- Android Studio Iguana | 2023.2.1 Patch 1
- Android Gradle Plugin 8.3.1
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
il...@gmail.com <il...@gmail.com> #30
Still happening with:
Android Studio Giraffe | 2022.3.1 Canary 5
classpath "com.android.tools.build:gradle:8.1.0-alpha05"
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.0.2"
java.lang.NoClassDefFoundError: Failed resolution of: Lj$/util/DesugarTimeZone;
at l52.<clinit>(SourceFile:14)
at m52.<clinit>(SourceFile:24)
at rg0.<clinit>(SourceFile:1)
at sg0.<clinit>(SourceFile:13)
at d24.b(SourceFile:12)
at w70.e(SourceFile:890)
at w82.e(SourceFile:156)
at i91.get(SourceFile:25)
at o72.get(SourceFile:14)
at n80.f(SourceFile:52)
at m91.d(SourceFile:106)
at m91.e(SourceFile:145)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:38)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2451)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2421)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:13)
at android.app.ActivityThread.installProvider(ActivityThread.java:7462)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6973)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6744)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2133)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
fa...@gmail.com <fa...@gmail.com> #31
when i use apk-viewer embedded in Android Studio and load mapping.txt the class shows up, also it works fine when I am using gradle-plugin version 7.4.1
Android Studio Giraffe | 2022.3.1 Canary 5
classpath "com.android.tools.build:gradle:8.1.0-alpha05"
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.0.2"
java.lang.NoClassDefFoundError: Failed resolution of: Lj$/time/format/DateTimeFormatter;
cl...@google.com <cl...@google.com> #32
Hi bingran@
It seems desugared library does not work at all in release mode in the latest Giraffe (AGP 8.1.0-alpha06) and all previous Giraffe. It works in Flamingo.
To reproduce:
- create an "Empty Views Activity" project,
- set desugared library (
https://developer.android.com/studio/write/java8-support#library-desugaring ), - set minifyEnabled true in release and do not alter the code in any way (not using desugared library)
It works fine in debug.
It crashed for me at start-up in release mode with:
java.lang.NoClassDefFoundError: Failed resolution of: Lj$/util/DesugarCollections;
at androidx.fragment.app.l0.<init>(SourceFile:44)
at androidx.fragment.app.u.<init>(SourceFile:13)
at androidx.fragment.app.v.<init>(SourceFile:9)
It seems that desugared library but all class names are minified. Do you have any clue? It seems release without shrinking the program but shrinking only desugared library works. Everything works fine in our local tests which let me believe (maybe wrongly) that agp is not passing the keep rules or flags correctly. Did you enable keep rules with trace reference or something like that?
bi...@google.com <bi...@google.com>
bi...@google.com <bi...@google.com> #33
It turns out the desugared apis are there but has been obfuscated when dexing with l8. If I disable obfuscation just like what we already do for non-minified release build, it works.
bi...@google.com <bi...@google.com> #34
Clement, is that expected?
When dexing desugar library with l8, we pass the program dex files generated from r8 so in theory l8 should be able to obfuscate the desugar library based on the usage from program dex files? Or apart from the program dex files, we need to pass more to l8? e.g. mapping file?
cl...@google.com <cl...@google.com> #35
I understand that desugared library has been obfuscated and that should not be the case. The keep rules (either output by R8 or through tracereference) should have prevented obfuscation. This used to work and this is still now fully tested in our test suite.
Your text confuses me. L8 should take as input the desugared library jar and not the dex files generated from r8.
Did you change the way the keep rules are generated for L8 for example by using trace reference instead of the direct r8 output? Are the keep rules identical? It seems to me the issue would be that the keep rules are incorrect.
For example, in the case above, I suspect that instead of generating:
-keep class j$.util.DesugarCollections {...}
We now have:
-keep class java.util.DesugarCollections {...}
How can I see the keep rules that agp generates for L8 a given build? I may be able to do it with dumps.
cl...@google.com <cl...@google.com> #36
Ok I figured it out.
The issue is that agp generates keep rules throught tracereference which looks like:
-keep,allowobfuscation class j$.util.concurrent.ConcurrentHashMap
We should essentially do the same but without the "allowobfuscation".
This could imply building the TraceReference command with something along the lines of:
TraceReferencesKeepRules.builder()
.setAllowObfuscation(false)
Could you fix this Bingran? I think this is P1 or P0.
cl...@google.com <cl...@google.com> #37
It would be nice if AGP could have a regression test for that too btw.
bi...@google.com <bi...@google.com> #38
With what #36 suggests, we are not doing obfuscation for desugar library apis in all the cases, right?
br...@gmail.com <br...@gmail.com> #39 Restricted
ra...@gmail.com <ra...@gmail.com> #40
- Giraffe Canary 8
- AGP 8.1.0-alpha08
- Kotlin 1.8.10
- Gradle 8.0.2
- Desugar 2.0.2
- minSdk 23
- targetSdk 33
- JDK 17
Also tested R8 dev builds but it's the same. Any suggest for a temporary workaround?
tr...@gmail.com <tr...@gmail.com> #41
ey...@gmail.com <ey...@gmail.com> #42
I have the same issue as in java.lang.NoClassDefFoundError: Failed resolution of: Lj$/util/DesugarTimeZone;
) using:
- AGP 8.1.0-alpha09
- Kotlin 1.8.10
- Gradle 8.0.2
- Desugar 2.0.2
- minSdk 24
- targetSdk 33
- JDK 17
The crash only started happening after updating from AGP 8.0.0-beta05 to AGP 8.1.0-alpha09.
I tried adding the proguard rules mentioned in allowobfuscation
and the crash still occurs.
If I set isMinifyEnabled = false
then the crash goes away.
Is there any way we can workaround this without downgrading to AGP 8.0.0?
Here's the full unobfuscated crash:
java.lang.NoClassDefFoundError: Failed resolution of: Lj$/util/DesugarTimeZone;
at com.google.firebase.encoders.json.JsonDataEncoderBuilder$TimestampEncoder.<clinit>(SourceFile:14)
at com.google.firebase.encoders.json.JsonDataEncoderBuilder.<clinit>(SourceFile:24)
at com.google.firebase.crashlytics.internal.model.serialization.CrashlyticsReportJsonTransform.<clinit>(SourceFile:1)
at com.google.firebase.crashlytics.internal.persistence.CrashlyticsReportPersistence.<clinit>(SourceFile:13)
at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.create(SourceFile:12)
at androidx.camera.video.Recorder$$ExternalSyntheticLambda2.create(SourceFile:982)
at com.google.firebase.tracing.ComponentMonitor$$ExternalSyntheticLambda0.create(SourceFile:18)
at com.google.firebase.FirebaseApp$$ExternalSyntheticLambda0.get(SourceFile:25)
at com.google.firebase.components.Lazy.get(SourceFile:14)
at com.google.firebase.components.ComponentRuntime.doInitializeEagerComponents(SourceFile:52)
at com.google.firebase.components.ComponentRuntime.initializeEagerComponents(SourceFile:35)
at com.google.firebase.FirebaseApp.initializeAllApis(SourceFile:71)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:36)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:7)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:12)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2451)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2421)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:13)
at android.app.ActivityThread.installProvider(ActivityThread.java:7474)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6985)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6756)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2129)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7884)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Caused by: java.lang.ClassNotFoundException: j$.util.DesugarTimeZone
at com.google.firebase.encoders.json.JsonDataEncoderBuilder$TimestampEncoder.<clinit>(SourceFile:14)
at com.google.firebase.encoders.json.JsonDataEncoderBuilder.<clinit>(SourceFile:24)
at com.google.firebase.crashlytics.internal.model.serialization.CrashlyticsReportJsonTransform.<clinit>(SourceFile:1)
at com.google.firebase.crashlytics.internal.persistence.CrashlyticsReportPersistence.<clinit>(SourceFile:13)
at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.create(SourceFile:12)
at androidx.camera.video.Recorder$$ExternalSyntheticLambda2.create(SourceFile:982)
at com.google.firebase.tracing.ComponentMonitor$$ExternalSyntheticLambda0.create(SourceFile:18)
at com.google.firebase.FirebaseApp$$ExternalSyntheticLambda0.get(SourceFile:25)
at com.google.firebase.components.Lazy.get(SourceFile:14)
at com.google.firebase.components.ComponentRuntime.doInitializeEagerComponents(SourceFile:52)
at com.google.firebase.components.ComponentRuntime.initializeEagerComponents(SourceFile:35)
at com.google.firebase.FirebaseApp.initializeAllApis(SourceFile:71)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:36)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:7)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:12)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2451)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2421)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:13)
at android.app.ActivityThread.installProvider(ActivityThread.java:7474)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6985)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6756)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2129)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7884)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
`
bi...@google.com <bi...@google.com> #43
Fixed with I6290c3f7f041b9b8330e69e4e5dbf5dbb187d550 which should be available in AGP 8.1 beta01. Thanks everyone for reporting this issue!
ey...@gmail.com <ey...@gmail.com> #44
Is there a version of R8 that we can use before beta 1 is related?
bi...@google.com <bi...@google.com> #45
Unfortunately I don't think changing the r8 version works. The only workaround(but not recommended) is to configure AGP task.
sk...@gmail.com <sk...@gmail.com> #46
Is the fix available in AGP 8.1.0-alpha10?
bi...@google.com <bi...@google.com> #47
re #46, not in 8.1.0-alpha10, it is available from AGP 8.1 beta01
ey...@gmail.com <ey...@gmail.com> #48
It's listed in the 8.1.0-alpha11 changelog.
bi...@google.com <bi...@google.com> #49
Can you point me to that change log?
bi...@google.com <bi...@google.com> #51
Actually our release schedule has changed and it should be available from 8.1.0-alpha11.
Description
After recent updates to Android Studio, the Gradle plugin, and other libraries, my app works just fine on debug builds with coreLibraryDesugaring enabled (v1.1.6 and v2.0.0).
However, when building the release version, it crashes right at the beginning with this stack trace:
Happens on all API levels.
Disabling core library desguaring entirely fixes the issue, as I don't rely on any desugared APIs.
Project details:
Android Studio version: Giraffe 2022.3.1 Canary 1. Android Gradle Plugin version: 8.1.0-alpha01. Kotlin version: 1.8.0. Gradle version (in wrapper): gradle-8.0-rc-1
Hope you fix this soon.