Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve: Error:Execution failed for task ':app:kaptDebugKotlin'?

Please help me I've been staring at this same error for days. I'm running android studio 2.3 (I've also ran into this problem on android studio 3.0).

This is what shows up in my Messages:

Error:Execution failed for task ':app:kaptDebugKotlin'. Internal compiler error. See log for more details

This is what my log gives me for more details:

2017-09-01 21:09:57,768 [34977075] INFO - roid.sdk.MessageBuildingSdkLog - Exception from KotlinOutputParser 2017-09-01 21:09:57,771 [34977078] INFO - roid.sdk.MessageBuildingSdkLog - com.android.ide.common.blame.Message.(com.android.ide.common.blame.Message$Kind, java.lang.String, java.lang.String, com.google.common.collect.ImmutableList) java.lang.NoSuchMethodException: com.android.ide.common.blame.Message.(com.android.ide.common.blame.Message$Kind, java.lang.String, java.lang.String, com.google.common.collect.ImmutableList) at java.lang.Class.getConstructor0(Class.java:3082) at java.lang.Class.getConstructor(Class.java:1825) at org.jetbrains.kotlin.android.KotlinOutputParserHelper$simpleMessageConstructor$2.invoke(KotlinOutputParserHelper.kt:171) at org.jetbrains.kotlin.android.KotlinOutputParserHelper$simpleMessageConstructor$2.invoke(KotlinOutputParserHelper.kt:143) at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:130) at org.jetbrains.kotlin.android.KotlinOutputParserHelper.getSimpleMessageConstructor(KotlinOutputParserHelper.kt) at org.jetbrains.kotlin.android.KotlinOutputParserHelper.createNewMessage(KotlinOutputParserHelper.kt:272) at org.jetbrains.kotlin.android.KotlinOutputParserHelper.createMessage(KotlinOutputParserHelper.kt:250) at org.jetbrains.kotlin.android.KotlinOutputParserHelper.createMessage$default(KotlinOutputParserHelper.kt:244) at org.jetbrains.kotlin.android.KotlinOutputParserHelperKt.parse(KotlinOutputParserHelper.kt:41) at org.jetbrains.kotlin.android.KotlinOutputParser.parse(KotlinOutputParser.java:28) at com.android.ide.common.blame.parser.ToolOutputParser.parseToolOutput(ToolOutputParser.java:86) at com.android.tools.idea.gradle.output.parser.BuildOutputParser.parseGradleOutput(BuildOutputParser.java:43) at com.android.tools.idea.gradle.project.build.invoker.GradleTasksExecutor$GradleTasksExecutorImpl.lambda$collectMessages$5(GradleTasksExecutor.java:516) at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:307) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

My top level build.gradle:

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

    buildscript {
        ext.kotlin_version = '1.1.4-3'
        repositories {
            google()
            jcenter()
            maven {
                url 'https://www.testfairy.com/maven'
            }
            mavenCentral()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.3.3'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            classpath 'com.testfairy.plugins.gradle:testfairy:1.+'
            classpath 'me.tatarka:gradle-retrolambda:3.3.0'
            //classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }

    allprojects {
        repositories {
            google()
            jcenter()
            maven { url "https://dl.bintray.com/aurae/maven" }
            maven { url "https://maven.google.com" }
        }
    }

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

my app level build.gradle: apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt'

    apply plugin: 'io.fabric'
    apply plugin: 'testfairy'
    apply plugin: 'me.tatarka.retrolambda'

    android {
        compileSdkVersion COMPILE_SDK_VERSION
        buildToolsVersion BUILD_TOOLS_VERSION

        defaultConfig {
            applicationId "com.audiopartnership.edgecontroller"
            minSdkVersion MIN_SDK_VERSION
            targetSdkVersion TARGET_SDK_VERSION
            versionCode 9
            versionName "0.0.12"
            vectorDrawables.useSupportLibrary = true
            multiDexEnabled true
            buildConfigField "String", "BASE_SSID", "\"Setup:\""
            buildConfigField "String", "DEFAULT_UNIT_NAME", "\"CZN\""
            buildConfigField "String", "CAST_URL", "\"http://www.google.com/cast/learn/audio/\""

        }

        testfairyConfig {
            apiKey getMyApiKey("testfairy")
            autoUpdate true
        }

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

            beta {
                applicationIdSuffix ".beta"
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            }

            debug {
                debuggable true
                applicationIdSuffix ".debug"
            }
        }

        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }

        dataBinding {
            enabled = true
        }
    }

    androidExtensions {
        experimental = true
    }

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

        dependencies {
            classpath 'io.fabric.tools:gradle:1.+'
        }
    }




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







    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        testCompile 'junit:junit:4.12'
        testCompile 'org.mockito:mockito-core:1.10.19'


        compile project(':smoip-cli')
        compile project(':cable-cli')
        compile project(':maskable-layout')
        compile project(':radio')


        compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
        kapt 'com.android.databinding:compiler:2.3.3'

        compile "com.android.support:appcompat-v7:$SUPPORT_VERSION"
        compile "com.android.support:design:$SUPPORT_VERSION"
        compile "com.android.support:support-v4:$SUPPORT_VERSION"
        compile "com.android.support:percent:$SUPPORT_VERSION"
        compile "com.android.support:palette-v7:$SUPPORT_VERSION"

        compile 'me.relex:circleindicator:1.1.8@aar'
        compile 'uk.co.chrisjenx:calligraphy:2.2.0'
        compile "com.squareup.picasso:picasso:$PICASSO_VERSION"
        compile "io.reactivex:rxandroid:$RXANDROID_VERSION"
        compile 'com.squareup.okhttp3:okhttp:3.2.0'
        compile "com.github.aurae:rxbonjour:0.4.0"
        compile "com.polidea.rxandroidble:rxandroidble:1.3.3"

        compile "com.squareup.retrofit2:retrofit:$RETROFIT_VERSION"
        compile "com.squareup.retrofit2:converter-gson:$RETROFIT_VERSION"
        compile "com.squareup.retrofit2:adapter-rxjava:$RETROFIT_VERSION"

        compile 'com.jakewharton:butterknife:8.5.1'
        annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
        compile 'com.johnpetitto.validator:validator:1.0.2'
        testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
        debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
        betaCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
        debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
        releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
        compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
            transitive = true;
        }

        compile project(path: ':cable-cli')
        compile 'com.android.support.constraint:constraint-layout:1.0.2'
    }


    //return a MY API KEY from a properties file.
    def getMyApiKey(String property) {
        Properties properties = new Properties()
        properties.load(new FileInputStream(".apikeys"))
        return "\"" + properties.getProperty(property) + "\""
    }
like image 635
ayoola adedeji Avatar asked Sep 01 '17 20:09

ayoola adedeji


1 Answers

I know this is an old post but after some searching, I always end up opening this question. Because of this, I thought it was good to share a way to resolve this issue.

First I thought it was because of some change of configurations I made. Mainly change some versions of the implementations i use and update the kotlin version. Other changes I made were changing the annotationProcessor of the glide compiler to kapt.

Because the error was

Error: execution failed for task ':app:kaptDebugKotlin'. Internal compiler error. See log for more details

I thought it was because of this change - but it wasn't.

The main change I've made and did not even think it could be a problem was update my project to JAVA 13

So to solve this I change it back to Android Studio JDK:

First go to File -> Project Structure... See image for details

Next, in the SDK Location tab (on the left), change the JDK location to "WhereYourAndroidStudioIsInstalled\Android Studio\jre" See image for details

In the end, rebuild the project and for me it worked, the error disappeared:

See image for details

like image 173
Helder Ventura Avatar answered Sep 17 '22 22:09

Helder Ventura