0

For an Android project which I'm developing I need* to use the Eclipse Collections framework. So I integrated it to my build.gradle according to their "get started", and imported the needed libraries. The problem is that when I tried to run the app on my Android device it fails with the message:

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. More than one file was found with OS independent path 'LICENSE-EDL-1.0.txt'

I did some googling and got to a few questions here at Stackoverflow with similar (though not identical) problems, but none of the proposed solutions worked for me (most of them suggested to add packagingOptions to build.gradle). If it matters anyhow - my app uses OpenCV4Android, and I'm developing it in Android Studio.

In addition, just to be clear, everything works fine without the Eclipse-Collections additions..

Here's of my app's build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.example.android.coftest"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'org.eclipse.collections:eclipse-collections-api:9.0.0'
    compile 'org.eclipse.collections:eclipse-collections:9.0.0'
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:support-v4:26.+'
    compile 'com.android.support:support-vector-drawable:26.+'
    testCompile 'junit:junit:4.12'
    compile project(':openCVLibrary330')
}

* it's not a must-have, but it makes my code more simple and elegant, and I would really like to have that.

noamgot
  • 3,962
  • 4
  • 24
  • 44

1 Answers1

0

add this in your gradle :

packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/LICENSE-EDL-1.0.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'

}

Sajad Rahmanipour
  • 397
  • 1
  • 3
  • 20
  • Thanks, but it's not working... :( Just to be clear, I added it in the `android{}` section of my gradle – noamgot Dec 15 '17 at 10:00
  • replace this : compile 'org.eclipse.collections:eclipse-collections-api:9.0.0' compile 'org.eclipse.collections:eclipse-collections:9.0.0' testCompile 'org.eclipse.collections:eclipse-collections-testutils:9.0.0' compile 'org.eclipse.collections:eclipse-collections-forkjoin:9.0.0' – Sajad Rahmanipour Dec 15 '17 at 10:04
  • Could you please edit you answer (add your comment to your answer)? It's quite hard to understand exactly what to do... thanks – noamgot Dec 15 '17 at 10:11