2016-03-18 20 views
1

添加PowerMock到我的gradle文件,現在建立時,我得到ZipException:重複項:org/junit/ClassRule.class添加PowerMock到我的gradle文件,現在建立時,我得到ZipException:重複條目:org/junit/ClassRule.class

這是我build.gradle

androidTestCompile 'org.mockito:mockito-core:1.10.19' 
androidTestCompile 'com.google.dexmaker:dexmaker:1.2' 
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2' 
androidTestCompile('junit:junit-dep:4.+') { 
    exclude module: 'hamcrest' 
    exclude module: 'hamcrest-core' 
} 
androidTestCompile('com.android.support:multidex-instrumentation:1.0.1') { 
    exclude group: 'com.android.support', module: 'multidex' 
} 
androidTestCompile ('org.powermock:powermock-module-junit4:1.6.3') { 
    exclude module: 'hamcrest-core' exclude module: 'objenesis' 
} 

如何排除來自powermock聲明junit相關的部分?

回答

1

添加exclude module: 'junit'做到了:

androidTestCompile ('org.powermock:powermock-module-junit4:1.6.3') { 
    exclude module: 'hamcrest-core' 
    exclude module: 'objenesis' 
    exclude module: 'junit' 
} 
相關問題