Search code examples
androidgradlegeb

Gebish on Android


im currently trying to add gebish into my project. I added the dependencies in my build.gradle, but it says :

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/services/org.codehaus.groovy.transform.ASTTransformation
    File1: C:\Users\Muco\.gradle\caches\modules-2\files-2.1\org.codehaus.groovy\groovy-all\2.4.5\1730f61e9c9e59fd1b814371265334d7be0b8d2\groovy-all-2.4.5.jar
    File2: C:\Users\Muco\.gradle\caches\modules-2\files-2.1\org.gebish\geb-ast\0.13.1\ad8ac4809edf1964636ca2817e48d447c4c0c15b\geb-ast-0.13.1.jar
    File3: C:\Users\Muco\.gradle\caches\modules-2\files-2.1\org.gebish\geb-implicit-assertions\0.13.1\ecfb15862e11eaa6b7e1b8179dc60621ae0ff5a\geb-implicit-assertions-0.13.1.jar

I often had "duplicate" problems, but i can't solve this one. What's the best i can do in this kind of situations? I mean i just do what the Doc says and copy-paste, but i get these errors.

build.gradle

apply plugin: 'com.android.application'

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
    }
}


android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.example.muco.staemme"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

dexOptions {
    incremental true
    javaMaxHeapSize "4g"
}
}


dependencies {
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.1'

    compile "org.gebish:geb-core:0.13.1"
    compile "org.seleniumhq.selenium:selenium-firefox-driver:2.52.0"
    compile "org.seleniumhq.selenium:selenium-support:2.52.0"

}

the libs,which came with the dependencies


Solution

  • I just had to add

    android.packagingOptions {
        exclude 'META-INF/services/org.codehaus.groovy.transform.ASTTransformation'
        exclude 'META-INF/LICENSE.txt'
    }
    

    and now it works.