1. 程式人生 > >gradle 使用 exclude 解決jar包衝突

gradle 使用 exclude 解決jar包衝突

1.檢視衝突的jar包,使用一下命令檢視

的 Terminal下敲 gradlew-qapp:dependencies 命令,

- com.android.support.test.espresso:espresso-core:2.2.2
     +--- com.squareup:javawriter:2.1.1
     +--- com.android.support.test:rules:0.5
     |    \--- com.android.support.test:runner:0.5
     |         +--- junit:junit:4.12
     |         |    \---

org.hamcrest:hamcrest-core:1.3
     |         \--- com.android.support.test:exposed-instrumentation-api-publish:0.5
     +--- com.android.support.test:runner:0.5 (*)
     +--- javax.inject:javax.inject:1
     +--- org.hamcrest:hamcrest-library:1.3
     |    \--- org.hamcrest:hamcrest-core:1.3

2.使用exclue排除

dependencies {
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile ('com.android.support:design:22.2.1')
            {
               
exclude group: 'com.android.support'
            }
    compile 'com.shamanland:fonticon:0.1.8'
    androidTestCompile 'com.android.support:support-annotations:22.2.1'
    androidTestCompile 'com.android.support.test:runner:0.3'
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2')
            {
               
exclude  group:'org.hamcrest'
            }
}