I am trying to update the AGP version to 7.0.0-beta03 from 4.1.2 and I ran into an issue with our tasks that generate resources.
Currently with android gradle plugin 4.1.2, we have code like this registering generated resources from a task:
afterEvaluate {
android.libraryVariants.all {
val outputPath = "$buildDir/generated/res/foo/$flavorName/${buildType.name}"
val resourceGeneratingTask = tasks.register(...)
val outputDirectory = project.file(outputPath)
val outputs = project.files(outputDirectory).builtBy(resourceGeneratingTask)
registerGeneratedResFolders(outputs)
}
}
After bumping to 7.0.0-beta03, where android.libraryVariants seems to be removed and replaced with androidComponents.onVariants {}, I am failing to find a way to hook our generated resources into the build. I see addResValue in the api, but that seems to be valid only for resources in values our generated resources are raw or drawable.
I found a medium article introducing the variant APIs and also a github repository with gradle recipes for android, but did not find anything helping our case.
from What is alternative to `registerGeneratedResFolders` with AGP 7.0.0+?
No comments:
Post a Comment