android - 错误 :Execution failed for task ':app:packageAllDebugClassesForMultiDex' in Android Studio

标签 android android-support-library aviary android-multidex adobecreativesdk

当我运行集成了用于照片编辑选项的 Creative SDK 的应用程序时,出现以下错误。

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

这是我的应用程序 gradle 文件。这里集成了用于图像编辑选项的创意 sdk 并启用了 multidex 选项。

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

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

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 "";
    }
}

最佳答案

尝试删除对 multidex 库的显式依赖(从 build.gradle 中的依赖项中删除 compile 'com.android.support:multidex:1.0.1' 行)。

当您指定 multiDexEnabled=true 时,gradle 插件会自动添加正确的版本。

关于android - 错误 :Execution failed for task ':app:packageAllDebugClassesForMultiDex' in Android Studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32043646/

相关文章:

android - 亚马逊 java.lang.VerifyError Android

Android ListView布局参数集

android - 带有 CollapsingToolbarLayout 的 CoordinatorLayout 与对话框 fragment 中的键盘中断

android - 如何在android中适应制表符宽度屏幕

android - 为什么两个不同的应用程序使用 aviary sdk 没有安装在同一台设备上?

android - 在单个 Activity 中使用多个 ViewModel.observe 是个好主意吗?

android - RecyclerView.Adapter.notifyItemChanged() 永远不会将有效负载传递给 onBindViewHolder()

android - Android 中的 Aviary SDK 更新

android - Android Aviary显示导入错误

Android 如何安装较旧的 API 版本?