2016-04-26 49 views
2

當我建立的APK安卓工作室(2.0版),我的項目文件中,有一個錯誤:安卓:duplicati輸入錯誤,同時建立APK文件

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

這裏是我的gradle這個文件:

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:[email protected]' 
    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' 
    } 
+0

昨天我同樣的錯誤在我的情況下,刪除多餘的支持-V4庫解決,如果您有任何刪除它。 – Nisarg

回答

1

在終端執行中根項目文件夾:

./gradlew clean 
2

它造成的,因爲你已經包括了圖書館作爲compile dependency,並將其包含在您的項目庫文件夾中。轉到您的項目libs folder並刪除重複的.jar文件。

7

試着改變你的依賴

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

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' 
} 
+1

我有同樣的問題,加入這爲我工作。但是你是如何得到這個解決方案的? –