无法解决这个问题:
错误:任务执行失败 ':应用程序:transformClassesWithJarMergingForDebugAndroidTest&#39 ;. com.android.build.api.transform.TransformException: java.util.zip.ZipException:重复条目: 组织/ hamcrest / BaseDescription.class
Orginal Gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://clojars.org/repo' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://clojars.org/repo' }
}
android {
signingConfigs {
config {
keyAlias 'urAndroid'
keyPassword 'ab123'
storePassword 'ab'
storeFile file('../cer/android.jks')
}
}
compileSdkVersion 23
buildToolsVersion "23.0.3"
lintOptions {
// but continue the build even when errors are found:
abortOnError false
}
defaultConfig {
applicationId "com.holandago.ur.ur"
minSdkVersion 15
targetSdkVersion 23
versionCode 66
versionName "2.9.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
debug {
debuggable true
testCoverageEnabled = true
}
release {
debuggable false
signingConfig signingConfigs.config
ext.betaDistributionEmails = "abr@gmail.com"
ext.betaDistributionReleaseNotes = "Release Notes for this build."
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'LICENSE.txt'
exclude 'META-INF/maven/com.google.guava/guava/pom.properties'
exclude 'META-INF/maven/com.google.guava/guava/pom.xml'
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.5.6@aar') {
transitive = true;
}
compile 'com.android.support:support-annotations:23.+'
compile 'com.google.guava:guava:18.0'
testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:robolectric:3.0'
testCompile 'org.mockito:mockito-all:1.10.19'
testCompile 'org.hamcrest:hamcrest-library:1.3'
androidTestCompile 'org.hamcrest:hamcrest-core:1.3'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.google.code.gson:gson:2.6.1'
androidTestCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support:support-annotations:23.+'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'org.mockito:mockito-all:1.10.19'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:design:23.+'
compile 'com.android.support:support-v4:23.+'
compile 'com.android.support:appcompat-v7:23+'
compile 'com.koushikdutta.ion:ion:1.3.8'
compile 'com.google.code.gson:gson:2.4'
compile 'com.pusher:pusher-java-client:0.3.3'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.mixpanel.android:mixpanel-android:4.6.4'
compile 'com.android.support:recyclerview-v7:23+'
compile 'com.jakewharton:butterknife:8.0.1'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.+'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.+'
androidTestCompile 'com.android.support.test.espresso:espresso-web:2.+'
compile('com.mapbox.mapboxsdk:mapbox-android-sdk:4.1.0-beta.1@aar') {
transitive = true
}
compile('com.mapbox.mapboxsdk:mapbox-android-services:1.1.0@aar') {
transitive = true
}
// Optional -- Hamcrest library
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
}
试过这个Gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://clojars.org/repo' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://clojars.org/repo' }
}
android {
signingConfigs {
config {
keyAlias 'urAndroid'
keyPassword 'ab123'
storePassword 'ab'
storeFile file('../cer/android.jks')
}
}
compileSdkVersion 23
buildToolsVersion "23.0.3"
lintOptions {
// but continue the build even when errors are found:
abortOnError false
}
defaultConfig {
applicationId "com.holandago.ur.ur"
minSdkVersion 15
targetSdkVersion 23
versionCode 66
versionName "2.9.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
debug {
debuggable true
testCoverageEnabled = true
}
release {
debuggable false
signingConfig signingConfigs.config
ext.betaDistributionEmails = "abr@gmail.com"
ext.betaDistributionReleaseNotes = "Release Notes for this build."
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'LICENSE.txt'
exclude 'META-INF/maven/com.google.guava/guava/pom.properties'
exclude 'META-INF/maven/com.google.guava/guava/pom.xml'
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.5.6@aar') {
transitive = true;
}
compile 'com.android.support:support-annotations:23.+'
compile 'com.google.guava:guava:18.0'
testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:robolectric:3.0'
testCompile 'org.mockito:mockito-all:1.10.19'
/* testCompile 'org.hamcrest:hamcrest-library:1.3'
androidTestCompile 'org.hamcrest:hamcrest-core:1.3'*/
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.google.code.gson:gson:2.6.1'
androidTestCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support:support-annotations:23.+'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'org.mockito:mockito-all:1.10.19'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:design:23.+'
compile 'com.android.support:support-v4:23.+'
compile 'com.android.support:appcompat-v7:23+'
compile 'com.koushikdutta.ion:ion:1.3.8'
compile 'com.google.code.gson:gson:2.4'
compile 'com.pusher:pusher-java-client:0.3.3'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.mixpanel.android:mixpanel-android:4.6.4'
compile 'com.android.support:recyclerview-v7:23+'
compile 'com.jakewharton:butterknife:8.0.1'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.+'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.+'
androidTestCompile 'com.android.support.test.espresso:espresso-web:2.+'
compile('com.mapbox.mapboxsdk:mapbox-android-sdk:4.1.0-beta.1@aar') {
transitive = true
}
compile('com.mapbox.mapboxsdk:mapbox-android-services:1.1.0@aar') {
transitive = true
}
// Optional -- Hamcrest library
/*androidTestCompile 'org.hamcrest:hamcrest-library:1.3'*/
}
编辑:
执行任务:[:app:assembleDebug,:app:assembleDebugAndroidTest]
按需配置是一项孵化功能。增量java 编译是一个孵化功能。 :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE:app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :应用:prepareComAndroidSupportAnimatedVectorDrawable2340Library 最新消息:app:prepareComAndroidSupportAppcompatV72340Library 最新消息:app:prepareComAndroidSupportDesign2340Library UP-TO-DATE :app:prepareComAndroidSupportMultidex101Library UP-TO-DATE :app:prepareComAndroidSupportRecyclerviewV72340Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42340Library UP-TO-DATE :应用:prepareComAndroidSupportSupportVectorDrawable2340Library 最新消息:app:prepareComCrashlyticsSdkAndroidAnswers137Library 最新消息:app:prepareComCrashlyticsSdkAndroidBeta115Library 最新消息:app:prepareComCrashlyticsSdkAndroidCrashlytics256Library 最新 :应用:prepareComCrashlyticsSdkAndroidCrashlyticsCore239Library 最新消息:app:prepareComJakewhartonButterknife801Library UP-TO-DATE :应用:prepareComMapboxMapboxsdkMapboxAndroidSdk410Beta1Library 最新 :应用:prepareComMapboxMapboxsdkMapboxAndroidServices110Library 最新消息:app:prepareComMapzenAndroidLost110Library UP-TO-DATE :app:prepareComMixpanelAndroidMixpanelAndroid464Library UP-TO-DATE :app:prepareDeHdodenhofCircleimageview200Library UP-TO-DATE :app:prepareIoFabricSdkAndroidFabric1311Library UP-TO-DATE :app:prepareDebugDependencies:app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE:app:generateDebugBuildConfig 最新消息:app:mergeDebugShaders UP-TO-DATE:app:compileDebugShaders UP-TO-DATE:app:generateDebugAssets UP-TO-DATE:app:mergeDebugAssets 最新消息:app:processDebugManifest UP-TO-DATE :app:fabricGenerateResourcesDebug:app:generateDebugResValues UP-TO-DATE:app:generateDebugResources:app:mergeDebugResources :app:processDebugResources:app:generateDebugSources :app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE :app:compileDebugJavaWithJavac UP-TO-DATE:app:compileDebugNdk 最新版:app:compileDebugSources UP-TO-DATE :app:prePackageMarkerForDebug:app:unzipJacocoAgent UP-TO-DATE :app:transformClassesWithJacocoForDebug UP-TO-DATE :app:transformClassesWithJarMergingForDebug UP-TO-DATE :app:collectDebugMultiDexComponents UP-TO-DATE :app:transformClassesWithMultidexlistForDebug UP-TO-DATE :app:transformClassesWithDexForDebug UP-TO-DATE :app:mergeDebugJniLibFolders UP-TO-DATE :app:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE :app:processDebugJavaRes UP-TO-DATE :app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE :app:validateDebugSigning:app:packageDebug:app:zipalignDebug :app:assembleDebug:app:preDebugAndroidTestBuild UP-TO-DATE :应用:prepareComAndroidSupportMultidexInstrumentation101Library 最新 :应用:prepareComAndroidSupportTestEspressoEspressoCore23AlphaLibrary 最新 :应用:prepareComAndroidSupportTestEspressoEspressoIdlingResource23AlphaLibrary 最新 :应用:prepareComAndroidSupportTestEspressoEspressoIntents23AlphaLibrary 最新 :应用:prepareComAndroidSupportTestEspressoEspressoWeb23AlphaLibrary 最新 :应用:prepareComAndroidSupportTestExposedInstrumentationApiPublish06AlphaLibrary 最新消息:app:prepareComAndroidSupportTestRules06AlphaLibrary 最新消息:app:prepareComAndroidSupportTestRunner06AlphaLibrary 最新消息:app:prepareDebugAndroidTestDependencies :app:compileDebugAndroidTestAidl UP-TO-DATE :app:processDebugAndroidTestManifest UP-TO-DATE :app:compileDebugAndroidTestRenderscript UP-TO-DATE :app:generateDebugAndroidTestBuildConfig UP-TO-DATE :app:mergeDebugAndroidTestShaders UP-TO-DATE :app:compileDebugAndroidTestShaders UP-TO-DATE :app:generateDebugAndroidTestAssets UP-TO-DATE :app:mergeDebugAndroidTestAssets UP-TO-DATE :app:generateDebugAndroidTestResValues UP-TO-DATE :app:generateDebugAndroidTestResources UP-TO-DATE :app:mergeDebugAndroidTestResources UP-TO-DATE :app:processDebugAndroidTestResources UP-TO-DATE :app:generateDebugAndroidTestSources UP-TO-DATE :app:incrementalDebugAndroidTestJavaCompilationSafeguard UP-TO-DATE :app:compileDebugAndroidTestJavaWithJavac UP-TO-DATE :app:compileDebugAndroidTestNdk UP-TO-DATE :app:compileDebugAndroidTestSources UP-TO-DATE :应用:prePackageMarkerForDebugAndroidTest :app:transformClassesWithJarMergingForDebugAndroidTest FAILED
失败:构建因异常而失败。
- 出了什么问题:任务执行失败':app:transformClassesWithJarMergingForDebugAndroidTest'。
com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目: 组织/ hamcrest / BaseDescription.class