Skip to content Skip to sidebar Skip to footer

In An Android Gradle Build, How To Exclude Dependencies From An Included Jar File?

In my Android project, I use a library that comes as a jar. I include it in the dependencies section like so: dependencies { ... compile files('libs/thethirdpartylibrary.

Solution 1:

Exclude the Group in the dependencies by using the below lines.

1.

configurations {
    all*.exclude group: 'com.android.support', module: 'support-v4'
}

2.

dependencies {
    compile'com.android.support:support-v4:13.0.+'compile ("com.xxx:xxx-commons:1.+") {
        exclude group: 'junit', module: 'junit'
    }
}

3.

configurations {
    runtime.exclude group: "org.slf4j", module: "slf4j-log4j12"
}

Try this one.

For more detail

Solution 2:

According to this discussion here https://groups.google.com/forum/#!topic/adt-dev/g1AiJM7PeVs, what you want to do is not possible.

The syntax suggested in the other answers is for "normal" Maven dependencies.

Post a Comment for "In An Android Gradle Build, How To Exclude Dependencies From An Included Jar File?"