gpt4 book ai didi

android - 将 jar 作为库添加到 Android Studio,错误 : More than one file was found with OS independent path 'META-INF/DEPENDENCIES'

转载 作者:行者123 更新时间:2023-11-29 23:29:23 27 4
gpt4 key购买 nike

我正在尝试将 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')

以上将包括库中的所有 jar。对吧?

您正在尝试使用特定路径再次添加相同的库。

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'
}

}

关于android - 将 jar 作为库添加到 Android Studio,错误 : More than one file was found with OS independent path 'META-INF/DEPENDENCIES' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52918619/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com