Error: More than one file was found with OS independent path 'META-INF/DEPENDENCIES'

旧时模样 提交于 2020-01-29 03:52:48

问题


I am using Selenium in Java to make an app. I keep getting this error and I have been searching the internet to figure out what is wrong and I cannot find anything. Please help.

Here is my build.gradle:

    android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "luke.luke.seleniumtest"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}



dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation files('libs/byte-buddy-1.7.9.jar')
    implementation files('libs/client-combined-3.9.1.jar')
    implementation files('libs/commons-codec-1.10.jar')
    implementation files('libs/commons-exec-1.3.jar')
    implementation files('libs/commons-logging-1.2.jar')
    implementation files('libs/gson-2.8.2.jar')
    implementation files('libs/guava-23.6-jre.jar')
    implementation files('libs/httpclient-4.5.3.jar')
    implementation files('libs/httpcore-4.4.6.jar')
    implementation files('libs/okhttp-3.9.1.jar')
    implementation files('libs/okio-1.13.0.jar')
}

回答1:


First, try to add this line: exclude 'META-INF/DEPENDENCIES', then Run 'app'

android {
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
    }
}

If error continue occur: 'META-INF/INDEX.LIST', keep adding exclude 'META-INF/INDEX.LIST':

android {
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/INDEX.LIST'
    }
}

Success for me!




回答2:


The simple solution instead of excluding it is to just do

    packagingOptions {
    pickFirst  'META-INF/*'
}

inside of the android{} in your build.gradle




回答3:


try add packagingOptions

android {
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
    }
}


来源:https://stackoverflow.com/questions/48958884/error-more-than-one-file-was-found-with-os-independent-path-meta-inf-dependenc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!