将 PowerMock 添加到我的 gradle 文件中,现在在构建时,我得到 ZipException: duplicate entry: org/junit/ClassRule.class

Added PowerMock to my gradle file, now when building, I get ZipException: duplicate entry: 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

添加 exclude module: 'junit' 成功了:

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