Java Android无法创建APK文件

Java Android无法创建APK文件,java,android,appium,Java,Android,Appium,我有一个简单的测试项目,我需要.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 c

我有一个简单的测试项目,我需要.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

错误是不言自明的:同一个类在不同的库中。它还列出了复制它们的类和库。那么,我应该删除它吗?在哪里可以找到它?为什么我要在我刚刚添加了2个依赖项和1个类的项目中获得这些副本?您发布的build.gradle不完整,请发布整个文件并保持其格式,以便我们可以正确阅读。如果你能发布一张你整个项目设置的图片,这将是很有帮助的。