本文介绍了错误:Android Studio中执行失败的任务“:packageAllDebugClassesForMultiDex:应用”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下错误,当我跑我的应用程序,其中的创意SDK集成了照片编辑选项。

 错误:执行失败的任务:应用程序:packageAllDebugClassesForMultiDex。
> java.util.zip.ZipException:重复的条目:安卓/支持/ multidex / MultiDex $ V14.class

这是我的应用摇篮图像编辑选项file.Here创意SDK集成并multidex选项启用。

 应用插件:'com.android.application安卓{
    compileSdkVersion 22
    buildToolsVersion22.0.1    defaultConfig {
        的applicationIDcom.ileaf.cameraeffects
        15的minSdkVersion
        targetSdkVersion 22
        版本code 1
        的versionName1.0
        multiDexEnabled真
    }
    buildTypes {
        发布 {
            minifyEnabled假
            proguardFiles getDefaultProguardFile('proguard的-android.txt'),'proguard-rules.pro
        }
    }
    sourceSets {
        主要{
            res.srcDirs = ['的src / main / RES','的src / main / RES /绘-华电国际','的src / main / RES /绘-MDPI','的src / main / RES /绘-xhdpi','在src / main / RES /阿尼姆']
        }
    }
    packagingOptions {
        排除META-INF / LICENSE.TXT
        排除META-INF / NOTICE.txt
    }
    dexOptions {
// jumboMode真
        真正的增量
        preDexLibraries假
// javaMaxHeapSize4G
    }}
allprojects {
    应用插件:'行家'    tasks.withType(JavaCompile){
        options.incremental =真
    }    库{
        mavenCentral()
        jcenter()        行家{
            网址$ {} project.rootDir / creativesdk回购/发布//创意SDK的基本位置
        }    }
    tasks.withType(JavaCompile){
        options.compilerArgs<< -Xlint:选中<< -Xlint:德precation
    }
}依赖{
    编译文件树(包括:['的* .jar'],DIR:库)
    编译com.android.support:appcompat-v7:22.2.0//编译com.adobe.creativesdk.foundation:assets:0.4.264
    编译com.adobe.creativesdk:图片:4.0.0    编译com.android.support:multidex:1.0.1
}

这是我的应用程序应用程序类。

 包com.ileaf.cameraeffects;进口android.support.multidex.MultiDexApplication;进口com.aviary.android.feather.sdk.IAviaryClientCredentials;公共类MyApplication的扩展MultiDexApplication实现IAviaryClientCredentials {
    @覆盖
    公共无效的onCreate(){
        super.onCreate();
    }    @覆盖
    公共字符串getBillingKey(){
        返回;
    }    @覆盖
    公共字符串getClientID(){
        返回;
    }    @覆盖
    公共字符串getClientSecret(){
        返回;
    }
}


解决方案

我删除了从依赖和multidex问题这条线解决​​了我。

编译文件树(包括:['的* .jar'],DIR:'库')

然后它来到了我的注意,我已经在我的库一个multidex jar文件folder.I删除,并回到列入依赖这条线上,它的工作。

I am getting the following error when I run my application where creative sdk is integrated for photo editing option.

Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: android/support/multidex/MultiDex$V14.class

This is my apps gradle file.Here creative sdk for image editing option is integrated and multidex option is enabled.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.ileaf.cameraeffects"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main {
            res.srcDirs = ['src/main/res', 'src/main/res/drawable-hdpi', 'src/main/res/drawable-mdpi', 'src/main/res/drawable-xhdpi', 'src/main/res/anim']
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
    dexOptions {
//        jumboMode true
        incremental true
        preDexLibraries false
//        javaMaxHeapSize "4g"
    }

}
allprojects {
    apply plugin: 'maven'

    tasks.withType(JavaCompile) {
        options.incremental = true
    }

    repositories {
        mavenCentral()
        jcenter()

        maven {
            url "${project.rootDir}/creativesdk-repo/release"  // The base location of Creative SDK
        }

    }
    tasks.withType(JavaCompile) {
        options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:22.2.0'

//        compile 'com.adobe.creativesdk.foundation:assets:0.4.264'
    compile 'com.adobe.creativesdk:image:4.0.0'

    compile 'com.android.support:multidex:1.0.1'
}

and this is my apps Application class.

package com.ileaf.cameraeffects;

import android.support.multidex.MultiDexApplication;

import com.aviary.android.feather.sdk.IAviaryClientCredentials;

public class MyApplication extends MultiDexApplication implements IAviaryClientCredentials {
    @Override
    public void onCreate() {
        super.onCreate();
    }

    @Override
    public String getBillingKey() {
        return "";
    }

    @Override
    public String getClientID() {
        return "";
    }

    @Override
    public String getClientSecret() {
        return "";
    }
}
解决方案

I removed this line from the dependencies and the multidex problem was solved for me.

compile fileTree(include: ['*.jar'], dir: 'libs')

Then it came to my attention that i already had a multidex jar file in my libs folder.I removed it and included back this line in dependencies and it worked.

这篇关于错误:Android Studio中执行失败的任务“:packageAllDebugClassesForMultiDex:应用”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 05:17