Are there docs anywhere for how to tell Android Gr...
# compose
z
Are there docs anywhere for how to tell Android Gradle Plugin pre-4.2 what the correct Compose compiler dependency is? I am trying to build some compose code in a project that can’t use 4.2 yet, and it looks like agp 4.1 is trying to use obsolete compiler dependency coordinates.
j
jetbrains plugin allow even AGP 4.0.1 I think
z
I’m getting this error:
Could not find androidx.compose:compose-compiler:1.0.0-alpha12.
I was pretty sure that was because the compiler artifact was renamed to
androidx.compose.compiler:compiler
, so the plugin is looking for an artifact that doesn’t exist.
🤔 1
Not sure how to tell it where the correct dep is
l
IIRC it is hardcoded so you can't override - but you can manually apply the compiler plugin yourself and avoid using AGP's built in configuration if you want
z
that sounds like what i want to do – got any examples of a project that’s doing that?
l
Ah, or maybe something like:
Copy code
subprojects {
    configurations.configureEach {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            def group = details.requested.group
            def module = details.requested.module.name
            def version = details.requested.version
            if (group == 'androidx.compose' && module == 'compose-compiler') {
                details.useTarget("androidx.compose.compiler:compiler:$version")
            }
        }
    }
}
To force using the new coordinates, not sure if any APIs changed here but this is probably easier than manually applying the plugin
z
oo, i’ll try that, thanks!
l
Alternatively for manually adding the plugin, something like this should still work: https://github.com/chrisbanes/tivi/pull/697/commits/cb9a8860b5ff8fc2471d328ed41ef5bf11c9e52d