Execution failed for task ':app:compileDebugKotlin'

Hi Everyone,
I have this problem in my app and I have already read the similar topics but unfortunately I couldn’t fix my problem with suggested solutions.

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileDebugKotlin'.
	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.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
	at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
	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:199)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
	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:123)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.gradle.api.GradleException: Compilation error. See log for more details
	at org.jetbrains.kotlin.gradle.tasks.TasksUtilsKt.throwGradleExceptionIfError(tasksUtils.kt:16)
	at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.processCompilerExitCode(Tasks.kt:428)
	at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompiler$kotlin_gradle_plugin(Tasks.kt:389)
	at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompiler$kotlin_gradle_plugin(Tasks.kt:273)
	at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.execute(Tasks.kt:235)
	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:73)
	at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
	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:199)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
	... 32 more
1 Like

lul. You have a compile error as it says. Fix your code :stuck_out_tongue_winking_eye:

The problem is that I don’t know where to look

The Man Who Does Not Read Has No Advantage Over the Man Who Cannot Read

if this the way of helping in this community, I think it is much better to be off here.
I just started to learn coding and I don’t know much about these stuff.
if you are looking for someone to show off and blame him/her for something that s/he doesn’t know you can carry on, but if you are here to actually help people then stop nagging and help.

People who look down on other people don’t end up being looked up to.
Robert Half

3 Likes

All you posted so far is that your code contains one or more errors. There is no way anyone can help you. And in general it’s disliked if someone just posts a stack trace without giving any information. It just looks like. Hey I have a problem can you solve it for me.

If you want help then we need some more information. What is the actual error message in the log. It should be a line which looks like this:

e: /Users/burkhard/Projects/Kotlin/tronjheim/tests/lwjgl/src/main/kotlin/tests/lwjgl/HelloWorld.kt: (162, 2): Expecting ')'

Most likely the error message is a different for you. Than you can look at your code at the specified place. Also normally the error messages kotlin generates are pretty easy to understand.

As for stack traces. They are a great tool for a developer, who has access to the code itself, but if you need to post it to a forum normally the Exception and sub exceptions are relevant. Everything else is just the call stack which only tells you what other functions have been called before (and this does not help someone who does not know the code).
Also the stack trace you posted is from gradle itself and not your program or the compiler. I guess you used the --stacktrace option. This is a feature used to debug the build system if you create your own tasks or complex build logic, which you probably won’t have to worry about unless you work on a big complex project.

I can understand the feeling, but look at it from the other side. You posted something with no information. Then you said you don’t know where to look, even though the exception you posted says to look in the log.
Yes, maybe my answer was not really the most productive, but if you head read your exception properly you, would have known that you have not given us all the information.
And even running the code without the stacktrace option you should have seen this part

* What went wrong:
Execution failed for task ':yourProjectName:compileKotlin'.
> Compilation error. See log for more details

Thank you for your comment and clarifying, but you could have asked for more info at the beginning right? anyways again thank you so much.

I will send them here, when I get home

That’s the entire point. I know this is hard at the beginning, but there is nearly no compiler error you should not be able to handle yourself. That’s also why I did not ask for more information. With exception of some corner cases and the rare case of a bug in the compiler itself, you should be able to solve the problem without having to ask here.
Don’t get me wrong, if you can’t solve it definitely ask, but only after actually trying. As I said before, kotlins error messages are normally pretty much self explanatory and kotlin has a very good documentation as well.
The problem I and other people here have is with people who post in forums even though all they need to do is use google. I know sometimes it is hard to know what search term to use. Learning this is one of the most important skills of a programmer IMO, but most of the time just copy paste your error message and maybe add the keyword “kotlin”.

1 Like

Most probably you should have to look at the codes that contain Async funtion or other coroutine or thread related code. If you post the code related to this functions i think you will get more help.

You sure you wanted to post that in this thread?

Why not?

Well this thread was mostly dead. I don’t know what any of this has to do with “async function or other coroutine or thread related code”. I just did not understand what you were trying to say in the context of this discussion.

I am sorry if i didn’t make it clear for you. But i was intending to help the man who posted the problem on the first place. If you have that same Error with your code this can help.

But he never said anything about coroutines or threads. The TaskExecutionException has nothing to do with concurrency, but is a gradle internal exception thrown whenever a task fails (e.g compiler error).

Nope Task is a part of coroutine man. I think he definatlely used a coroutine in his code.

org.gradle.api.tasks.TaskExecutionException Definitely part of kotlins coroutine API and in no way part of gradles task system. Sure.

2 Likes

By using “./gradlew assembleDebug”, we will be able to get a more meaningful error message. In my case, “./gradlew assembleDebug” show me exactly where my source code needs fixes.

Definitely, there is still some gap between Android Studio building and building with Gradle itself.

1 Like

To be fair to OP I got to this exact point and was left wondering “what log?”. The stack trace doesn’t provide any link to a file or any indication what to do next.

FWIW I was able to get better details in Android Studio by first turning on --stacktrace for Android Studio builds:

Secondly I was able to see those logs by toggling Build view:

I agree that gradle might produce a bit more output than required, but I must wonder why people use the “–stacktrace”, “–info” or “–debug” option before they read the rest of the generated output.
The stacktrace shouldn’t even be displayed unless you run gradle with an argument intended for debugging the build process and not finding compilation errors.
Yes, “see log for more details” sounds like there might be a log file, but still why not read the rest of the output first, before posting questions? Maybe it should be changed to something like “see log above for more details”.