android - 将 jars 作为库添加到 Android Studio,错误:发现多个文件与操作系统无关路径 'META-INF/DEPENDENCIES'
问题描述
我正在尝试将 Selenium 添加到 Android Studio,以便在设备处于待机模式时自动化 Web 表单。我不断遇到越来越多的错误。我将所有 .jars 添加到 Lib 文件中并将它们添加为库,然后我遇到了这个问题。请帮我。这是我的毕业典礼:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "mul.luke.selenium"
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:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation files('libs/byte-buddy-1.7.9.jar')
implementation files('libs/okio-1.13.0.jar')
implementation files('libs/okhttp-3.9.1.jar')
implementation files('libs/httpcore-4.4.6.jar')
implementation files('libs/httpclient-4.5.3.jar')
implementation files('libs/guava-23.6-jre.jar')
implementation files('libs/gson-2.8.2.jar')
implementation files('libs/commons-logging-1.2.jar')
implementation files('libs/commons-exec-1.3.jar')
implementation files('libs/commons-codec-1.10.jar')
implementation files('libs/client-combined-3.11.0-sources.jar')
implementation files('libs/client-combined-3.11.0.jar')
}
解决方案
implementation fileTree(include: ['*.jar'], dir: 'libs')
以上将包括库中的所有罐子。正确的?
您正在尝试使用特定路径再次添加相同的库。
implementation files('libs/byte-buddy-1.7.9.jar')
排除 PackagingOptions 中的依赖项,
android {
compileSdkVersion 27
defaultConfig {
applicationId "mul.luke.selenium"
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'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
}
}
推荐阅读
- javascript - 使用带有 JSON 数据的 Input 组件创建 Cascading 3 Level Select Dropdown
- azure - 为什么 Azure DevOps 不选择具有整数参数的 ARM 部署?
- linux - 在编辑器中重定向 bash 脚本输出而不保存文件
- kubernetes - Azure Kubernetes 服务 - 即使我没有明确设置自动缩放,集群自动缩放器是否也会被触发?
- spring-mvc - 带有 Java 15 依赖项“Spring Web”的 Spring Starter 报告“执行失败”
- python - Python connect 4播放功能
- javascript - 根据chart.js中的计数和过滤器按月和周对数据进行分组
- java - 如何测量单向延迟?
- sas - 删除 SAS 中的重复子字符串
- javascript - (Vue 和 Firebase)我在将多个图像保存在数组中时遇到问题