gradle 使用 exclude 解决jar包冲突

 

1.查看冲突的jar包,使用一下命令查看

Android Studio的 Terminal下敲 gradlew  xxxx:dependencies 命令,查看依赖树

gradlew xxxx_new:dependencies --configuration compile 查看编译时的依赖树

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

 

 

 

你可能感兴趣的:(android,studio,android)