将JAR作为库添加到Android Studio中,错误:发现多个文件具有独立于操作系统的路径';META-INF/DEPENDENCIES';
我正在尝试将Selenium添加到Android studio,以便在设备处于待机模式时自动生成web表单。我不断地遇到越来越多的错误。我将所有的.jar添加到Lib文件中,并将它们添加为库,然后遇到了这个问题。请帮帮我。这是我的毕业证书:将JAR作为库添加到Android Studio中,错误:发现多个文件具有独立于操作系统的路径';META-INF/DEPENDENCIES';,android,android-studio,gradle,web-scraping,bots,Android,Android Studio,Gradle,Web Scraping,Bots,我正在尝试将Selenium添加到Android studio,以便在设备处于待机模式时自动生成web表单。我不断地遇到越来越多的错误。我将所有的.jar添加到Lib文件中,并将它们添加为库,然后遇到了这个问题。请帮帮我。这是我的毕业证书: apply plugin: 'com.android.application' android { compileSdkVersion 27 defaultConfig { applicationId "mul.lu
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')
}
以上内容将包括LIB中的所有JAR。对吧?
您正在尝试使用特定路径再次添加相同的库
implementation files('libs/byte-buddy-1.7.9.jar')
排除PackageOptions中的依赖项
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'
}
}
删除所有的实现仍然会给我留下相同的错误@navarasu打包时是否需要这些文件?是的,我需要它们作为库。我不知道包装时是否需要它们。然后添加包装选项将解决您的问题。你能查一下吗?。我已经编辑了答案
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'
}
}