Skip to content

AGP 8.4.1 gives issue due to usage of deprecated API #334

Description

@bddckr

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") }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions