Android Gradle 3.0 how to exclude multi groups

Viewed 1894

As we know, in Gradle previous 3.0 version, we can exclude multi groups and modules by following code:

compile('com.lean.util:jiabujia:2.5.0') {
        exclude group: 'com.squareup.okhttp3', module: 'okhttp'
        exclude group: 'com.android.support', module: 'appcompat-v7'
}

but in Gradle 3.0 how can I achieve the same thing?

1 Answers

As of gradle 3.0 you have to do this now:

 android.testVariants.all { variant ->
variant.getCompileConfiguration().exclude group: 'com.squareup.okhttp3', module: 'okhttp'
variant.getRuntimeConfiguration().exclude group: 'com.squareup.okhttp3', module:  'okhttp'
variant.getCompileConfiguration().exclude group:'com.android.support' , module: 'appcompat-v7'
variant.getRuntimeConfiguration().exclude group:'com.android.support' , module:  'appcompat-v7'
}

Please check this: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html

Related