TaskExecutionException:app:transformClassesWithDexForDebug

时间:2019-07-03 11:40:17

标签: android android-studio

我找不到问题所在,我也共享了build.gradle文件

Stacktrace:     org.gradle.api.tasks.TaskExecutionException:任务':app:transformClassesWithDexForDebug'的执行失败。         在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)         在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)         在org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)处         在org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:66)         在org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)         在org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)         在org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)         在org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)         在org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)         在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)处         在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)处         在org.gradle.execution.taskgraph.Abs​​tractTaskPlanExecutor $ TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)         在org.gradle.execution.taskgraph.Abs​​tractTaskPlanExecutor $ TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)         在org.gradle.internal.concurrent.ExecutorPolicy $ CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)         在org.gradle.internal.concurrent.StoppableExecutorImpl $ 1.run(StoppableExecutorImpl.java:40)         在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)         在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)         在java.lang.Thread.run(Thread.java:745)

Caused by: java.lang.RuntimeException: com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
    at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:54)
    at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:158)
    at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:173)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:245)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:221)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:232)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 17 more

Caused by: com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
    at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:443)
    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:178)
    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:174)
    at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:156)
    ... 29 more

Caused by: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
    at com.android.builder.core.DexByteCodeConverter.dexOutOfProcess(DexByteCodeConverter.java:210)
    at com.android.builder.core.DexByteCodeConverter.runDexer(DexByteCodeConverter.java:159)
    at com.android.builder.core.DexByteCodeConverter.convertByteCode(DexByteCodeConverter.java:146)
    at com.android.builder.core.AndroidBuilder.convertByteCode(AndroidBuilder.java:1422)
    at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:272)
    ... 32 more


Caused by: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at com.android.builder.core.DexByteCodeConverter.dexOutOfProcess(DexByteCodeConverter.java:206)
    ... 36 more


Caused by: java.lang.UnsupportedOperationException
    at com.android.ide.common.process.ProcessInfoBuilder$JavaProcessInfoImpl.getExecutable(ProcessInfoBuilder.java:349)
    at com.android.build.gradle.internal.process.GradleProcessResult.buildProcessException(GradleProcessResult.java:74)
    at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:49)
    at com.android.builder.core.DexByteCodeConverter.lambda$dexOutOfProcess$1(DexByteCodeConverter.java:196)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    ... 3 more

build.gradle:

repositories {
    jcenter()
    maven {
        url "https://maven.google.com"
    }
}



android {
    compileSdkVersion 26
    buildToolsVersion "27.0.2"
    useLibrary 'org.apache.http.legacy'

    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }

    aaptOptions {
        cruncherEnabled = false
    }

    dexOptions {

        preDexLibraries = false
        javaMaxHeapSize "4g" // 2g should be also OK
    }


    defaultConfig {

        minSdkVersion 14
        targetSdkVersion 26
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile files('libs/gcm.jar')
    compile files('libs/gson-1.7.jar')
    compile files('libs/acra-4.8.2.jar')
    compile files('libs/mpandroidchartlibrary-2-2-4.jar')
    compile files('libs/universal-image-loader-1.8.4-with-sources.jar')
    compile 'me.relex:circleindicator:1.2.2@aar'
    compile 'com.google.maps.android:android-maps-utils:0.5+'
    compile 'com.squareup:android-times-square:1.5.0@aar'
    //compile fileTree(dir: 'libs', include: ['*.jar'])


    // circular loader
    compile 'com.victor:lib:1.0.4'

    compile ('com.google.code.gson:gson:1.7'){
        exclude module: 'support-v4'
    }
    compile ('com.astuetz:pagerslidingtabstrip:1.0.1'){
        exclude module: 'support-v4'
    }

    compile ('com.theartofdev.edmodo:android-image-cropper:2.6.+'){
        exclude module: 'support-v4'
    }

    compile ('com.google.android.gms:play-services-maps:7.8.0')
            {
                exclude module: 'support-v4'
            }

    compile ('com.google.android.gms:play-services:7.8.0'){
        exclude module: 'support-v4'
    }

    compile 'com.android.support:multidex:1.0.0'

    //compile ('androidx.multidex:multidex:2.0.1')
}

1 个答案:

答案 0 :(得分:0)

删除gradle目录文件夹,并再次与gradle文件同步。

  • 删除文件夹.gradle
  • 清洁项目
  • 与gradle文件同步
  • 屏住呼吸:)