Elye
Elye

Reputation: 60061

Combining multiple library to use a single exclude list

In my gradle.build, I have various library that perform the same exclusion as below

androidTestCompile ('com.android.support.test:runner:0.5') {
    exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestCompile ('com.android.support.test:rules:0.5')  {
    exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2') {
    exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestCompile ('com.android.support.test.espresso:espresso-web:2.2.2') {
    exclude group: 'com.android.support', module: 'support-annotations'
}

Obviously, everyone is using the same exclude

    exclude group: 'com.android.support', module: 'support-annotations'
}

Is there a way, that I need only to write the exclude once, and apply to all libraries (at least those that I am interested to perform exclusion)?

Upvotes: 4

Views: 453

Answers (1)

mdtuyen
mdtuyen

Reputation: 4528

There is a config to excude for all instance in project:

configurations.all { exclude ... }

Upvotes: 1

Related Questions