任务执行失败':app:transformDexArchiveWithExternalLibsDexMergerForDebug'

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了任务执行失败':app:transformDexArchiveWithExternalLibsDexMergerForDebug'相关的知识,希望对你有一定的参考价值。

我正在运行应用程序时在android studio中遇到错误。

:app:mergeDebugJniLibFolders
:universalimageloader:compileDebugNdk NO-SOURCE
:universalimageloader:mergeDebugJniLibFolders
:universalimageloader:transformNativeLibsWithMergeJniLibsForDebug
:universalimageloader:transformNativeLibsWithStripDebugSymbolForDebug
:universalimageloader:transformNativeLibsWithIntermediateJniLibsForDebug UP-TO-DATE
:app:transformNativeLibsWithMergeJniLibsForDebug
:app:processDebugJavaRes NO-SOURCE
:app:transformResourcesWithMergeJavaResForDebug
:app:transformNativeLibsAndResourcesWithJavaResourcesVerifierForDebug
:app:transformClassesWithInstantRunForDebug
:app:transformClassesEnhancedWithInstantReloadDexForDebug
:app:incrementalDebugTasks
:app:preColdswapDebug
:app:fastDeployDebugExtractor
:app:generateDebugInstantRunAppInfo
:app:transformClassesWithInstantRunSlicerForDebug
:app:transformClassesWithDexBuilderForDebug
:app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
:app:buildInfoGeneratorDebug

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 22s

59 actionable tasks: 36 executed, 23 up-to-date

我正在使用ndk支持的项目。一直都很好,直到明天。我试过的是:

  1. 删除应用级构建目录,
  2. 删除项目级构建目录,
  3. 删除项目下的.gradle文件夹,
  4. Android Studio - >构建 - >清理项目 - >制作项目(5次)
  5. Android Studio - >文件 - >无效缓存/重启(2次)。

有什么我想念的吗?

here is my --RunWith --Stacktrace


:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:universalimageloader:mergeDebugShaders UP-TO-DATE
:universalimageloader:compileDebugShaders UP-TO-DATE
:universalimageloader:generateDebugAssets UP-TO-DATE
:universalimageloader:mergeDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:transformClassesWithDexBuilderForDebug
:app:transformClassesWithMultidexlistForDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't write [E:Run_AS_EFinal_AppsExito_finalBedroom Photo Framesappuildintermediatesmulti-dexdebugcomponentClasses.jar] (Can't read [C:UsersQuickcode9.gradlecaches	ransforms-1files-1.1support-core-ui-27.1.0.aar79d2738f98f02922870eae8feb3b0abajarsclasses.jar(;;;;;;**.class)] (Duplicate zip entry [classes.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]))

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.RuntimeException: java.io.IOException: Can't write [E:Run_AS_EFinal_AppsExito_finalBedroom Photo Framesappuildintermediatesmulti-dexdebugcomponentClasses.jar] (Can't read [C:UsersQuickcode9.gradlecaches	ransforms-1files-1.1support-core-ui-27.1.0.aar79d2738f98f02922870eae8feb3b0abajarsclasses.jar(;;;;;;**.class)] (Duplicate zip entry [classes.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]))
    at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:55)
    at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:104)
    at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:213)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
    ... 27 more
Caused by: java.io.IOException: Can't write [E:Run_AS_EFinal_AppsExito_finalBedroom Photo Framesappuildintermediatesmulti-dexdebugcomponentClasses.jar] (Can't read [C:UsersQuickcode9.gradlecaches	ransforms-1files-1.1support-core-ui-27.1.0.aar79d2738f98f02922870eae8feb3b0abajarsclasses.jar(;;;;;;**.class)] (Duplicate zip entry [classes.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]))
    at proguard.OutputWriter.writeOutput(OutputWriter.java:187)
    at proguard.OutputWriter.execute(OutputWriter.java:79)
    at proguard.ProGuard.writeOutput(ProGuard.java:427)
    at proguard.ProGuard.execute(ProGuard.java:175)
    at com.android.build.gradle.internal.transforms.BaseProguardAction.runProguard(BaseProguardAction.java:61)
    at com.android.build.gradle.internal.transforms.MainDexListTransform.shrinkWithProguard(MainDexListTransform.java:232)
    at com.android.build.gradle.internal.transforms.MainDexListTransform.transform(MainDexListTransform.java:184)
    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:222)
    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:218)
    at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
    ... 39 more
Caused by: java.io.IOException: Can't read [C:UsersQuickcode9.gradlecaches	ransforms-1files-1.1support-core-ui-27.1.0.aar79d2738f98f02922870eae8feb3b0abajarsclasses.jar(;;;;;;**.class)] (Duplicate zip entry [classes.jar:android/support/design/widget/CoordinatorLayout$Behavior.class])
    at proguard.InputReader.readInput(InputReader.java:188)
    at proguard.InputReader.readInput(InputReader.java:158)
    at proguard.OutputWriter.writeOutput(OutputWriter.java:176)
    ... 48 more
Caused by: java.io.IOException: Duplicate zip entry [classes.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]
    at proguard.io.JarWriter.getOutputStream(JarWriter.java:138)
    at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:106)
    at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:106)
    at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:92)
    at proguard.io.ClassRewriter.read(ClassRewriter.java:68)
    at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
    at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
    at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
    at proguard.io.JarReader.read(JarReader.java:65)
    at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65)
    at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53)
    at proguard.InputReader.readInput(InputReader.java:184)
    ... 50 more


* Get more help at https://help.gradle.org

BUILD FAILED in 22s

这是我的build.gradle文件..

apply plugin: 'com.android.application'
android {
    compileSdkVersion 26
    buildToolsVersion '26.0.3'
    defaultConfig {
        applicationId "com.xxxxxxxxx.xxxxxxxxxxxxx.xxxx.xxx"
        minSdkVersion 17
        //noinspection OldTargetApi
        targetSdkVersion 26
        multiDexEnabled true

        manifestPlaceholders = [onesignal_app_id               : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
                                // Project number pulled from dashboard, local value is ignored.
                                onesignal_google_project_number: "REMOTE"]

    }
    buildTypes {
        debug {
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            applicationVariants.all { variant ->

                //noinspection GrDeprecatedAPIUsage
                if (variant.getBuildType().isMinifyEnabled()) {
                    variant.outputs.all { output ->
                        def stringsFile = android.sourceSets.main.res.sourceFiles.find {
                            it.name.equals 'strings.xml'
                        }
                        output.outputFileName = "${new XmlParser().parse(stringsFile).string.find { it.@name.equals 'app_name' }.text()}.apk"
                    }

                    variant.assemble.doLast {
                        copy {
                            from variant.mappingFile
                            into "../doc_app_upload/mapping prog"
                            rename { String fileName ->
                                "mapping_${variant.versionName}.txt"
                            }
                        }
                    }
                }
            }
        }
    }

    externalNativeBuild {
        cmake {
            path 'src/main/jni/CMakeLists.txt'
        }
    }

    dexOptions {
        javaMaxHeapSize "4g"
    }

}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //basic-res
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    //noinspection GradleCompatible
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    //firebase analytics and ads
    //noinspection GradleCompatible
    implementation 'com.google.firebase:firebase-ads:11.8.0'
    implementation 'com.google.firebase:firebase-core:11.8.0'

    //Startapp-ads
    implementation 'com.startapp:inapp-sdk:3.6.9'
    //App Update Notification
    implementation 'com.github.javiersantos:AppUpdater:2.6.1'
    // one signal
//    implementation 'com.onesignal:OneSignal:3.+@aar'
    implementation 'com.onesignal:OneSignal:3.8.1@aar'
    implementation 'com.google.android.gms:play-services-gcm:11.8.0'
    // retrofit, gson
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    //other dependencies
    //noinspection GradleDependency
    implementation 'org.adw.library:discrete-seekbar:1.0.1'
    implementation 'com.android.support:multidex:1.0.2'
    // Image Chooser , Image Loader, Image Cropper
    implementation 'com.kbeanie:image-chooser-library:1.5.8@aar'
    implementation 'com.github.bumptech.glide:glide:3.8.0'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'// 2.5.1

    // Color Picker
    implementation 'com.github.rtugeek:ColorSeekBar:1.5.2'
    implementation 'com.rarepebble:colorpicker:2.2.0'
    // filter effects
    //noinspection GradleDependency
    implementation 'org.wysaid:gpuimage-plus:2.4.6-min'
    //    compile 'org.wysaid:gpuimage-plus:2.4.6-min-armv7a' //Recommended
    implementation 'com.ogaclejapan.smarttablayout:library:1.6.1@aar'
    implementation 'com.ogaclejapan.smarttablayout:utils-v4:1.6.1@aar'
    implementation 'com.github.zomato:androidphotofilters:1.0.1'
    implementation 'com.intuit.sdp:sdp-android:1.0.4'
    // retrofit gson
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation project(':universalimageloader')
}
apply plugin: 'com.google.gms.google-services'
答案

尝试在Android Studio中禁用即时运行,然后重建所有内容。

以上是关于任务执行失败':app:transformDexArchiveWithExternalLibsDexMergerForDebug'的主要内容,如果未能解决你的问题,请参考以下文章

任务执行失败':app:transformDexArchiveWithExternalLibsDexMergerForDebug'

text 任务':app:transformClassesWithDexBuilderForDebug'的执行失败。

text “任务执行失败”:app:compileDebugJavaWithJavac'本地反应“

错误:任务':app:transformDexWithInstantRunSlicesApkForDebug'的执行失败。无法读取zip文件

任务':app:transformClassesWithMultidexlistForDebug'重复Zip条目的执行失败

错误:'com.android.build.api.transform.TransformException:生成主dex列表时出错。'