Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bddckr opened this issue May 22, 2024 · 1 comment
Open

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

bddckr opened this issue May 22, 2024 · 1 comment
Labels

Comments

@bddckr
Copy link

bddckr commented May 22, 2024

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.

instrumentationTestVariant.registerGeneratedResFolders(
project.files(outputFolder).builtBy(provider)
)

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") }
@mannodermaus
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants