I am using Gradle 8.4, and Android Gradle Plugin 8.1.2. Here is a custom plugin.
class MyPlugin : Plugin<Project> {
override fun apply(project: Project) {
val androidComponents = project.extensions.getByType(AndroidComponentsExtension::class.java)
androidComponents.onVariants { variant ->
Logger.v("variant:$variant")
Logger.v("artifacts:${variant.artifacts}")
...
}
}
the code above prints:
variant:com.android.build.api.component.analytics.AnalyticsEnabledApplicationVariant_Decorated@28b221b7
artifacts:com.android.build.api.component.analytics.AnalyticsEnabledArtifacts_Decorated@4015ca9
I am expecting the artifacts
to be ScopedArtifactsImpl
, so I can use reflections to invoke the toTransform
function which has 5 params, since to default toTransform
function only allows one output.
The strange thing is that it was originally ScopedArtifactsImpl, and then suddenly changed to AnalyticsEnabledArtifacts at some point.