3

I am having this error while trying to build my app:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:kaptReleaseKotlin'. 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:8) at org.jetbrains.kotlin.gradle.internal.KaptTask.compile(KaptTask.kt:124) 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.StandardTaskAction.doExecute(StandardTaskAction.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.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:780) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:747) 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

I have looked at other answers similar to this one, but regarding :app:compileDebugKotlin, that always pointed out to some code error, but I couldn't find where mine is.

app gradle:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'

repositories {
maven { url 'https://maven.fabric.io/public' }
google()
}

buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    // These docs use an open ended version so that our plugin
    // can be updated quickly in response to Android tooling updates

    // We recommend changing it to the latest version from our changelog:
    // https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
    classpath 'io.fabric.tools:gradle:1.24.1'
}
}

// Create a variable called keystorePropertiesFile, and initialize it to your
// keystore.properties file, in the rootProject folder.
def keystorePropertiesFile = rootProject.file("keystore.properties")

// Initialize a new Properties() object called keystoreProperties.
def keystoreProperties = new Properties()

// Load your keystore.properties file into the keystoreProperties object.
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
signingConfigs {
    config {
        keyAlias keystoreProperties['keyAlias']
        keyPassword keystoreProperties['keyPassword']
        storeFile file(keystoreProperties['storeFile'])
        storePassword keystoreProperties['storePassword']
    }
}
compileSdkVersion 27
buildToolsVersion '27.0.3'

defaultConfig {
    applicationId "package name"
    versionCode 45
    versionName "5.4"
    minSdkVersion 15
    targetSdkVersion 27

    javaCompileOptions {
        annotationProcessorOptions {
            arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
        }
    }
}

packagingOptions {
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE-FIREBASE.txt'
    exclude 'META-INF/NOTICE'
}

buildTypes {
    release {
        debuggable true
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
        signingConfig signingConfigs.config
    }
}
productFlavors {
}

sourceSets {
    androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:support-v4:27.1.0'

implementation 'com.google.android.gms:play-services-drive:12.0.1'
implementation files('libs/opencsv-2.3.jar')
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'

implementation 'com.android.support:mediarouter-v7:27.1.0'
implementation 'com.google.android.gms:play-services-cast:12.0.1'

implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.google.firebase:firebase-database:12.0.1'
implementation 'com.google.firebase:firebase-auth:12.0.1'

implementation 'com.google.android.gms:play-services-auth:12.0.1'

implementation ('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
    transitive = true
}

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

implementation 'android.arch.lifecycle:extensions:1.1.1'

implementation 'android.arch.persistence.room:rxjava2:1.0.0'
implementation 'android.arch.persistence.room:runtime:1.1.0-beta1'
kapt 'android.arch.persistence.room:compiler:1.1.0-beta1'

implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.8'
}

apply plugin: 'com.google.gms.google-services'

project gradle:

buildscript {
ext.kotlin_version = '1.2.30'
repositories {
    jcenter()
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
    google()
}
dependencies {
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'com.android.tools.build:gradle:3.1.0'
    classpath 'com.google.gms:google-services:3.2.1'
}
}

allprojects {
repositories {
    jcenter()
    google()
}
}

It started after an upgrade to:

Android Studio 3.1 Build #AI-173.4670197, built on March 21, 2018 JRE: 1.8.0_152-release-1024-b01 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Mac OS X 10.13.3

But I was also updating my code.

I am using --stacktrace and --debug in the Compiler Command-line Options. I would appreciate any help at pointing my error in my gradle configuration or any hint to improve the stacktrace so I could reach the error.

ColdFire
  • 6,764
  • 6
  • 35
  • 51
Andre Rocha
  • 988
  • 1
  • 12
  • 21

2 Answers2

2

Ok. The answer of DeltaCap in the post pointed by Ege Error:Execution failed for task ':app:compileDebugKotlin'. > Compilation error. See log for more details made me search for gradle-console and I ended up looking at this post Show Gradle Console when running task that solved the problem of looking for the useful error message so I could find and solve the source error.

I will accept the suggestion that the first post solved my problem, but I want to thank everyone that have posted in or answered this question. Thank you.

Andre Rocha
  • 988
  • 1
  • 12
  • 21
0

I solved a similar problem in my app. Turned out to be a problem with a SQLite query. The query used a select parameter "arg0" but the parameter needed to match the name of the parameter passed to the method. This didn't become an error until upgrading to Kotlin 1.2.30.

  • But did the build point you to the error ? Or the message it gave you was the same of my question ? Before the upgrade I had some Query issues and the build pointed me to the error, but now the message is different, I was thinking the error was in my gradle file. – Andre Rocha Apr 04 '18 at 09:28
  • @AndreRocha you can get this error from literally anything, missin xml tag, a class that is supposted to be open or even a missing annotation – Ege Kuzubasioglu Apr 04 '18 at 10:48
  • Ok. So where do I go to see where the error is ? Formerly Android Studio would point me to the error in the Log, but not now, that's why I am lost. – Andre Rocha Apr 04 '18 at 11:59