Fixed
Status Update
Comments
vi...@google.com <vi...@google.com>
je...@google.com <je...@google.com>
ga...@google.com <ga...@google.com> #2
This seems to be an issue with Aapt2DaemonBuildService
class instances coming from 2 different class loaders. I've reached out to Gradle to check if there is a way to work around this and I'll post updates here.
ga...@google.com <ga...@google.com> #3
I'll change how we name build services. Right now it is only Aapt2DaemonBuildService.class.name
, but I'll append the hash code to make it unique across class loaders Aapt2DaemonBuildService.class.name + Aapt2DaemonBuildService.class.hashCode()
.
ga...@google.com <ga...@google.com> #4
je...@google.com <je...@google.com> #5
alternatively, you can look at how it is done for Workers listeners, basically using the mbean server to ensure a single instance accross class loaders.
ga...@google.com <ga...@google.com> #6
Some of the services are used to instantiate objects so it would be quite tricky. I'd rather just have one per class instance as this is not a typical setup. We should work wiht Gradle on fixing this long-term.
Description
Error message:
Cannot set the value of property 'aapt2DaemonBuildService' of type com.android.build.gradle.internal.services.Aapt2DaemonBuildService using a provider of type com.android.build.gradle.internal.services.Aapt2DaemonBuildService.
See attachment for full stacktrace.Sample project:https://github.com/daugeldauge/agp-plugin-management-bug
Project configures successfully if you don't apply Kotlin plugin in
lib
module or downgrade AGP to 3.6.3Gradle version: 6.3; Android Plugin Version: can reproduce on 4.1.0-alpha06, 4.0.0-beta04; can't reproduce on 3.6.3; Module Compile Sdk Version: 29; Android SDK Tools version: 26.1.1; Kotlin version: 1.3.71