Execution failed for task ':app:compileRetrolambdaDebug'

自作多情 提交于 2021-02-09 15:22:51

问题


I use retrolambda a long time, but suddenly he stopped working in all my projects. I reinstalled jdk, but it didn't help. I didn't find answer in google, i hope you can help me. My gradle files: build.gradle (app):

 apply plugin: 'com.android.application'
 apply plugin: 'me.tatarka.retrolambda'

    android {
        compileSdkVersion 25
        buildToolsVersion "25.0.1"
        defaultConfig {
            applicationId "xsystem.ru.test"
            minSdkVersion 16
            targetSdkVersion 25
            versionCode 1
            versionName "1.0"

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

        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }


    }



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

build.gradle (Project):

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'me.tatarka:gradle-retrolambda:3.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }

}


task clean(type: Delete) {
    delete rootProject.buildDir
}

Gradle stacktrace:

19:32:51.295 [ERROR] [org.gradle.BuildExceptionReporter] 
19:32:51.295 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter] 
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':app:compileRetrolambdaDebug'.
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter] > Process 'command 'C:\Program Files\Java\jdk1.8.0_121\bin\java.exe'' finished with non-zero exit value -1073740791
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter] 
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileRetrolambdaDebug'.
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:66)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_121\bin\java.exe'' finished with non-zero exit value -1073740791
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:367)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.process.internal.DefaultJavaExecAction.execute(DefaultJavaExecAction.java:31)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.file.DefaultFileOperations.javaexec(DefaultFileOperations.java:170)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.AbstractProject.javaexec(AbstractProject.java:848)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.AbstractProject.javaexec(AbstractProject.java:844)
19:32:51.296 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.Project$javaexec$11.call(Unknown Source)
19:32:51.297 [ERROR] [org.gradle.BuildExceptionReporter]    at me.tatarka.RetrolambdaTask.execute(RetrolambdaTask.groovy:69)
19:32:51.297 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
19:32:51.297 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:245)
19:32:51.297 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:221)
19:32:51.297 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:232)
19:32:51.297 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
19:32:51.297 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
19:32:51.297 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
19:32:51.297 [ERROR] [org.gradle.BuildExceptionReporter]    ... 14 more
19:32:51.297 [ERROR] [org.gradle.BuildExceptionReporter] 

回答1:


Update class path to

classpath 'me.tatarka:gradle-retrolambda:3.2.5'

then add this to your dependencies

retrolambdaConfig 'net.orfjackal.retrolambda:retrolambda:2.3.0'

Add following code to application block

compileOptions { 
    sourceCompatibility JavaVersion.VERSION_1_8 
    targetCompatibility JavaVersion.VERSION_1_8
}

After this it should work.

Update:
The latest version of retrolambda till today (September 11 2017) is 3.7.0




回答2:


Add this in app gradle build file before android block (on top)

   //noinspection GradleCompatible
    apply plugin: 'com.android.application'
    apply plugin: 'me.tatarka.retrolambda'

 tasks.whenTaskAdded { task ->
 if (task.name.startsWith("lint")) {
    task.enabled = false
  }
 }


retrolambda {
jvmArgs '-noverify'
}

and I also changed my class path version from 3.4.0 to 3.2.5 and my issue resolved.

Also no need to add retroLambdaConfig



来源:https://stackoverflow.com/questions/42191221/execution-failed-for-task-appcompileretrolambdadebug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!