1

Ao rodar um teste, simples para verificar as configurações, aparece o seguinte erro:

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebugAndroidTest'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/hamcrest/BaseDescription.class

Classe de teste:

@RunWith(AndroidJUnit4.class)
public class ActivityTest {
    public static SearchRidesFragment searchRidesFragment;

    @Rule
    public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(
            MainActivity.class);

    @Test
    @SmallTest
    public void show(){
        onView(withId(R.id.search)).check(matches(isDisplayed()));

    }

}

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 'bAndroid'
            keyPassword 'ab23'
            storePassword 'ab123'
            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.b"
        minSdkVersion 15
        targetSdkVersion 19
        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 = "[email protected]"
            ext.betaDistributionReleaseNotes = "Release Notes for this build."
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'LICENSE.txt'
    }
    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;
    }
    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.4.0'
    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.4.0'
    compile 'com.android.support:support-v4:23.4.0'
    compile 'com.android.support:appcompat-v7:23.4.0'
    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.4.0'
    compile 'com.jakewharton:butterknife:8.0.1'
    compile 'com.android.support:support-annotations:23.4.0'
    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
    }
}

Alguma sugestão?

2
  • Tente adaptar essa resposta para sua pergunta. Abs
    – viana
    1/09/2016 às 17:13
  • @seamusd opa. É um outro erro. Mesmo me utilizando desta antiga ajuda sua, ele me retorna este erro. Voltei um commit que tinha feito com este gradle e mesmom assim ele deu problema.
    – Henrique
    1/09/2016 às 17:55

1 Resposta 1

0

Só foi possível resolver, voltando um commit e um branch diferente do que se encontrava estas alterações.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .