Search code examples
androidcatalog

Android Studio: New library catalogue - how to exclude a component


In Android Studio (Koala) and in the app's build file, I'm trying to implement a library but exclude a group/component of it. I tried multiple ways to do it, but it's not working for me.

implementation(libs.googleApiClientAndroid,) {
    exclude("org.apache.httpcomponents")
}

This is my current implementation snippet. But the exclude is wrong. I have the googleApiClientAndroid set up in the libs.versions.toml file.


Solution

  • There is no support yet for version catalog references and exclude blocks. See here.

    You need to write the dependency in a string for it to work:

    implementation("this.is:a-lib:1.2.3") {
        exclude(group = "another.lib", module = "that-i-do-not-want")
    }