将aws java sdk:1.11.973添加到我的gradle文件中,运行时不断抛出模块错误中发现的重复类

5jdjgkvh  于 2021-08-25  发布在  Java
关注(0)|答案(0)|浏览(199)

我已经阅读了很多类似的问题和解决方案,但似乎没有解决问题的方法。这是我的build.gradle文件

plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 30

    defaultConfig {
        applicationId "com.****"
        minSdkVersion 26
        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
        // Support for Java 8 features
        coreLibraryDesugaringEnabled true
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

dependencies {

    implementation 'androidx.appcompat:appcompat:1.3.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.hbb20:ccp:2.2.2'
    implementation 'com.google.android.flexbox:flexbox:3.0.0'
    implementation 'com.github.bumptech.glide:glide:4.12.0'

    implementation 'com.amplifyframework:aws-auth-cognito:1.18.0'

    implementation 'com.amazonaws:aws-java-sdk:1.11.973'

    // Support for Java 8 features
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'

    implementation 'com.amplifyframework:aws-datastore:1.18.0'

    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

这就是我得到的错误

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------

* What went wrong:

Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class com.amazonaws.AbortedException found in modules jetified-aws-android-sdk-core-2.25.0-runtime (com.amazonaws:aws-android-sdk-core:2.25.0) and jetified-aws-java-sdk-core-1.11.404 (com.amazonaws:aws-java-sdk-core:1.11.404)
     Duplicate class com.amazonaws.AmazonClientException found in modules jetified-aws-android-sdk-core-2.25.0-runtime (com.amazonaws:aws-android-sdk-core:2.25.0) and jetified-aws-java-sdk-core-1.11.404 (com.amazonaws:aws-java-sdk-core:1.11.404)
     Duplicate class com.amazonaws.AmazonServiceException found in modules jetified-aws-android-sdk-core-2.25.0-runtime (com.amazonaws:aws-android-sdk-core:2.25.0) and jetified-aws-java-sdk-core-1.11.404 (com.amazonaws:aws-java-sdk-core:1.11.404)
     Duplicate class com.amazonaws.AmazonServiceException$ErrorType found in modules jetified-aws-android-sdk-core-2.25.0-runtime (com.amazonaws:aws-android-sdk-core:2.25.0) and jetified-aws-java-sdk-core-1.11.404 (com.amazonaws:aws-java-sdk-core:1.11.404)

还有更多的重复。以前我使用独立依赖关系来满足我的需要,但是后来我不得不获得完整的sdk,这导致了这个错误。请帮忙。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题