简体   繁体   中英

DuplicatedError while running my app in Android Studio

I know there are lots of answers for my questions but none of them worked for me. Does someone know why this is hapening even if I exclude the two files in gradle.build.

Error:Execution failed for task ':projectPacatioClient:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK org/joda/time/tz/data/America/Argentina/Tucuman
    File1: /Users/as/StudioProjects/Project Pacatio Client2/projectPacatioClient/libs/aws-android-sdk-2.0.4-core.jar
    File2: /Users/as/.gradle/caches/modules-2/files-2.1/joda-time/joda-time/2.4/89e9725439adffbbd41c5f5c215c136082b34a7f/joda-time-2.4.jar

Here is my Gradle.build file.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion '21.0.0'

    defaultConfig {
        applicationId "io.kit.pc"
        minSdkVersion 11
        targetSdkVersion 21
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled false
        }
    }
    apply plugin: 'eclipse'
    defaultConfig {
        multiDexEnabled true
    }

}

dependencies {
    compile project(':libraryCropper')
    compile files('libs/gcm.jar')
    //compile 'com.google.android.gms:play-services-gcm:7.8.0'
    compile 'com.google.android.gms:play-services:4.4.52'
    compile 'com.android.support:support-v4:21.0.0'
    compile 'com.google.maps:google-maps-services:0.1.3'
    //compile 'com.google.android.gms:play-services-gcm:7.8.0'
    compile files('libs/aws-android-sdk-2.0.4-core.jar')
    compile files('libs/aws-android-sdk-2.0.4-s3.jar')
    compile files('libs/braintree-api-1.3.0-full.jar')
    androidTestCompile files('libs/libGoogleAnalyticsServices.jar')
    compile files('libs/universal-image-loader-1.9.3.jar')
}

I have faced the same issue.
Just remove your duplicate library from build.gradle file. Cross check with app->libs if already exists there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM