Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: duplicati entry error while build APK file

When I build an APK file with android studio (version 2.0) for my project, there is a error:

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/oltu/oauth2/common/OAuth$ContentType.class

Here is my gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }

    defaultConfig {
        applicationId "com.db.android.app.denhathai"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 14
        versionName "1.2.2"
        multiDexEnabled true

        manifestPlaceholders = [manifestApplicationId          : "${applicationId}",
                                onesignal_app_id               : "bad49395-e355-4802-8df1-414be2d345ac",
                                onesignal_google_project_number: "1071797880741"]
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    }

    dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.android.support:design:+'
    compile 'com.google.android.gms:play-services-ads:+'
    compile 'com.facebook.android:facebook-android-sdk:4.+'
    compile 'com.github.fengdai:alertdialogpro-theme-material:0.2.6'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
    compile 'com.onesignal:OneSignal:2.+@aar'
    compile 'com.google.android.gms:play-services-gcm:+'
    compile 'com.google.android.gms:play-services-analytics:+'
    compile 'com.google.android.gms:play-services-location:+'
    compile 'com.thefinestartist:finestwebview:1.2.1'
    compile 'com.squareup.okhttp3:okhttp:3.2.0'
    compile 'com.github.franmontiel:PersistentCookieJar:1c351f68d3'
    compile 'com.squareup.okhttp3:okhttp-urlconnection:3.0.0-RC1'
    compile 'org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.1'
    }
like image 668
NghiaDao Avatar asked Dec 05 '22 18:12

NghiaDao


1 Answers

Try changing your dependency

compile 'org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.1'

to

compile ("org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.1"){
    exclude group:'org.apache.oltu.oauth2' , module: 'org.apache.oltu.oauth2.common'
}
like image 60
Panduka DeSilva Avatar answered Dec 10 '22 11:12

Panduka DeSilva