簡體   English   中英

建立APK會產生錯誤:執行任務失敗

[英]Building an APK generates Error:Execution failed for task

當我嘗試使用當前的gradle.build文件進行構建時,出現錯誤,然后按照我的gradle進行構建。

為什么會導致此錯誤?

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzaf$zzd.class

這是我的build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.usmans.videodownloader"
        minSdkVersion 17
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    useLibrary 'org.apache.http.legacy'

}

dependencies {

androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'

// glide
compile 'com.github.bumptech.glide:glide:3.7.0'

compile 'com.squareup.okio:okio:1.11.0'


compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.android.gms:play-services-analytics:8.4.0'

compile 'com.facebook.android:audience-network-sdk:4.+'

compile 'com.io.tools.android.ramiloif.folderchooser:folderchooser-dialog:1.0.6'

我不知道是什么原因造成的。 我該怎么做才能解決這個問題?

從Facebook庫中更改和排除gms。

compile ('com.facebook.android:audience-network-sdk:4.+'){
        exclude group:"com.google.android.gms"
    }

然后清理並重建您的項目。

希望它能工作:)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM