2016-07-12 9 views
3

In meinem gradle.build ausschließen eine einzige zu verwenden, habe ich verschiedene Bibliothek, die das gleiche Ausschluss wie untenmehrere Bibliothek Kombination Liste

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' 
} 

Offensichtlich durchführen, wird jeder die gleiche

exclude group: 'com.android.support', module: 'support-annotations' 
} 
ausschließen Verwendung

Gibt es eine Möglichkeit, dass ich den Ausschluss nur einmal schreiben muss und auf alle Bibliotheken anwenden muss (zumindest diejenigen, die ich ausschließen möchte)?

Antwort

1

Es gibt eine Config für alle Instanz in einem Projekt excude:

configurations.all { exclude ... } 
+0

Wo soll ich die Config setzen? Ich versuchte in build.gradle, aber es beschwert 'Method Anruf ist mehrdeutig' – Elye

+0

in Android {}, bitte – phongvan

+0

Es funktioniert, aber es beschweren sich,' Methodenaufruf ist mehrdeutig'. Ist das etwas Besorgnis erregend? – Elye