android-junit5
android-junit5 copied to clipboard
AGP 8.4.1 gives issue due to usage of deprecated API
The issue has already been reported to the AGP maintainers here. However, I wonder whether there's a replacement API that isn't deprecated that this project could use to work around the problem. https://github.com/mannodermaus/android-junit5/blob/38ef72c06afe2dc23e94bf7d32cff5a41992b52c/plugin/android-junit5/src/main/kotlin/de/mannodermaus/gradle/plugins/junit5/tasks/AndroidJUnit5WriteFilters.kt#L51-L53
I believe the latest API to do the same is one of the following.
androidComponents.onVariants { variant ->
variant.sources.res?.let { res -> res.addGeneratedSourceDirectory(...) }
}
There's also addStaticSourceDirectory, but since the output of a task is needed here, addGeneratedSourceDirectory is probably the right one.
An example can be found here. The Readme for that example project is in the root folder.
I've applied the following workaround in my project for now:
tasks
.named {
it == "generateDebugAndroidTestLintModel" || it == "lintAnalyzeDebugAndroidTest"
}
.configureEach { dependsOn("writeFiltersDebugAndroidTest") }
Hey, thanks for reporting. We've been getting away with the old Variant API for many years now, but I guess all things must come to an end eventually. Since the next plugin version raises the minimum AGP requirement to 8.0, we finally have access to the new Variant API for source directories throughout all of the supported versions, so I'm okay with swapping out the implementation
Released in plugin 1.10.2.0!