错误:在OS独立路径中发现了多个文件' META-INF / DEPENDENCIES'

时间:2018-02-24 02:54:36

标签: java android selenium gradle build.gradle

我在Java中使用Selenium制作应用程序。我一直收到这个错误,我一直在网上找出问题所在,我找不到任何东西。请帮忙。

这是我的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')
}

3 个答案:

答案 0 :(得分:6)

简单的解决方案(而不是排除它)只是做

    packagingOptions {
    pickFirst  'META-INF/*'
}

在build.gradle中的android {}内部

答案 1 :(得分:4)

首先,尝试添加以下行:排除“ META-INF / DEPENDENCIES”,然后运行“ app”

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

如果继续发生错误:“ META-INF / INDEX.LIST”,请继续添加排除项“ META-INF / INDEX.LIST”:

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

对我来说成功!

答案 2 :(得分:2)

尝试添加packagingOptions

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