java - Android 无法创建 APK 文件
问题描述
我有一个简单的测试项目,我需要 .apk 文件才能在 Browserstack 中使用,但是当我尝试这样做时,我得到了错误:
Duplicate class org.apache.commons.logging.Log found in modules commons-logging-1.2 (commons-logging:commons-logging:1.2) and spring-jcl-5.3.4 (org.springframework:spring-jcl:5.3.4)
Duplicate class org.apache.commons.logging.LogFactory found in modules commons-logging-1.2 (commons-logging:commons-logging:1.2) and spring-jcl-5.3.4 (org.springframework:spring-jcl:5.3.4)
Duplicate class org.apache.commons.logging.LogFactory$1 found in modules commons-logging-1.2 (commons-logging:commons-logging:1.2) and spring-jcl-5.3.4 (org.springframework:spring-jcl:5.3.4)
Duplicate class org.apache.commons.logging.impl.NoOpLog found in modules commons-logging-1.2 (commons-logging:commons-logging:1.2) and spring-jcl-5.3.4 (org.springframework:spring-jcl:5.3.4)
Duplicate class org.openqa.selenium.WebDriver$Window found in modules java-client-7.5.1 (io.appium:java-client:7.5.1) and selenium-api-3.141.59 (org.seleniumhq.selenium:selenium-api:3.141.59)
Duplicate class org.openqa.selenium.WebElement found in modules java-client-7.5.1 (io.appium:java-client:7.5.1) and selenium-api-3.141.59 (org.seleniumhq.selenium:selenium-api:3.141.59)
Duplicate class org.openqa.selenium.internal.FindsByClassName found in modules java-client-7.5.1 (io.appium:java-client:7.5.1) and selenium-api-3.141.59 (org.seleniumhq.selenium:selenium-api:3.141.59)
Duplicate class org.openqa.selenium.internal.FindsByCssSelector found in modules java-client-7.5.1 (io.appium:java-client:7.5.1) and selenium-api-3.141.59 (org.seleniumhq.selenium:selenium-api:3.141.59)
Duplicate class org.openqa.selenium.internal.FindsById found in modules java-client-7.5.1 (io.appium:java-client:7.5.1) and selenium-api-3.141.59 (org.seleniumhq.selenium:selenium-api:3.141.59)
//and so on
Go to the documentation to learn how to Fix dependency resolution errors.
这个项目是从头开始制作的,但不知怎的,我遇到了很多冲突。
build.gradle file
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.mobiletest"
minSdkVersion 18
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation group: 'io.appium', name: 'java-client', version: '7.5.1'
testImplementation group: 'org.testng', name: 'testng', version: '7.4.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
当我运行我的测试方法时,它工作正常,但我无法创建 .apk
解决方案
推荐阅读
- sql - 如何在不显示所有结果的最大值的情况下为数学运算以及其他元素选择最大值
- laravel - nginx 无法使用 Laravel Forge 颁发 letencrypt ssl 证书
- java - 如何在 application.properties 文件中不通过 datasource.URL 显式传递数据库名称
- html - ajax函数后jquery重新加载页面
- javascript - 我在滚动标题上的粘性覆盖了内容
- go - pvc存储容量更新
- django - 如何在 DRF 中捕获所有 500 及以上的错误并记录它们?
- d3.js - D3 scaleBand() 导致路径属性错误
- terraform - Terraform 允许 AKS 使用 ACR
- python - 使用 Matplotlib 在一条线上选择 N 个点