简体   繁体   English

Using Eclipe Collections with Android - build.gradle fails

[英]Using Eclipe Collections with Android - build.gradle fails

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.

add this in your gradle:将此添加到您的 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'

} }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM