java 错误:发现多个文件与操作系统独立路径“META-INF/DEPENDENCIES”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48958884/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error: More than one file was found with OS independent path 'META-INF/DEPENDENCIES'
提问by LUKER
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.
我在 Java 中使用 Selenium 来制作应用程序。我一直收到这个错误,我一直在网上搜索以找出问题所在,但我找不到任何东西。请帮忙。
Here is my build.gradle:
这是我的 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')
}
回答by Brent
The simple solution instead of excluding it is to just do
简单的解决方案而不是排除它就是这样做
android {
packagingOptions {
pickFirst 'META-INF/*'
}
}
回答by TedVN
First, try to add this line: exclude 'META-INF/DEPENDENCIES', then Run 'app'
首先,尝试添加这一行:排除'META-INF/DEPENDENCIES',然后运行'app'
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
}
}
If error continue occur: 'META-INF/INDEX.LIST', keep adding exclude 'META-INF/INDEX.LIST':
如果错误继续发生:'META-INF/INDEX.LIST',继续添加排除'META-INF/INDEX.LIST':
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/INDEX.LIST'
}
}
Success for me!
为我成功!
回答by sanemars
try add packagingOptions
尝试添加包装选项
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
}
}