有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何解决:错误:任务“:app:kaptDebugKotlin”的执行失败?

请帮帮我,我已经盯着这个错误好几天了。我正在运行AndroidStudio 2.3(我在AndroidStudio 3.0上也遇到了这个问题)

以下是我的邮件中显示的内容:

Error:Execution failed for task ':app:kaptDebugKotlin'. Internal compiler error. See log 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.安卓.ide.common.blame.Message.(com.安卓.ide.common.blame.Message$Kind, java.lang.String, java.lang.String, com.google.common.collect.ImmutableList) java.lang.NoSuchMethodException: com.安卓.ide.common.blame.Message.(com.安卓.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.安卓.KotlinOutputParserHelper$simpleMessageConstructor$2.invoke(KotlinOutputParserHelper.kt:171) at org.jetbrains.kotlin.安卓.KotlinOutputParserHelper$simpleMessageConstructor$2.invoke(KotlinOutputParserHelper.kt:143) at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:130) at org.jetbrains.kotlin.安卓.KotlinOutputParserHelper.getSimpleMessageConstructor(KotlinOutputParserHelper.kt) at org.jetbrains.kotlin.安卓.KotlinOutputParserHelper.createNewMessage(KotlinOutputParserHelper.kt:272) at org.jetbrains.kotlin.安卓.KotlinOutputParserHelper.createMessage(KotlinOutputParserHelper.kt:250) at org.jetbrains.kotlin.安卓.KotlinOutputParserHelper.createMessage$default(KotlinOutputParserHelper.kt:244) at org.jetbrains.kotlin.安卓.KotlinOutputParserHelperKt.parse(KotlinOutputParserHelper.kt:41) at org.jetbrains.kotlin.安卓.KotlinOutputParser.parse(KotlinOutputParser.java:28) at com.安卓.ide.common.blame.parser.ToolOutputParser.parseToolOutput(ToolOutputParser.java:86) at com.安卓.tools.idea.gradle.output.parser.BuildOutputParser.parseGradleOutput(BuildOutputParser.java:43) at com.安卓.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)

我的顶级身材。格拉德尔:

    // 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.安卓.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-安卓-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
    }

我的应用程序级构建。格拉德尔: 应用插件:com。安卓应用程序' 应用插件:“kotlin 安卓” 应用插件:“kotlin 安卓扩展” 应用插件:“kotlin kapt”

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

    安卓 {
        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-安卓.txt'), 'proguard-rules.txt'
            }

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

            debug {
                debuggable true
                applicationIdSuffix ".debug"
            }
        }

        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }

        dataBinding {
            enabled = true
        }
    }

    安卓Extensions {
        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.安卓.databinding:compiler:2.3.3'

        compile "com.安卓.support:appcompat-v7:$SUPPORT_VERSION"
        compile "com.安卓.support:design:$SUPPORT_VERSION"
        compile "com.安卓.support:support-v4:$SUPPORT_VERSION"
        compile "com.安卓.support:percent:$SUPPORT_VERSION"
        compile "com.安卓.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:rx安卓:$RXANDROID_VERSION"
        compile 'com.squareup.okhttp3:okhttp:3.2.0'
        compile "com.github.aurae:rxbonjour:0.4.0"
        compile "com.polidea.rx安卓ble:rx安卓ble: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-安卓-no-op:1.5'
        debugCompile 'com.squareup.leakcanary:leakcanary-安卓:1.5'
        betaCompile 'com.squareup.leakcanary:leakcanary-安卓-no-op:1.5'
        debugCompile 'com.squareup.leakcanary:leakcanary-安卓:1.5'
        releaseCompile 'com.squareup.leakcanary:leakcanary-安卓-no-op:1.5'
        compile('com.crashlytics.sdk.安卓:crashlytics:2.6.8@aar') {
            transitive = true;
        }

        compile project(path: ':cable-cli')
        compile 'com.安卓.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) + "\""
    }

共 (1) 个答案

  1. # 1 楼答案

    我知道这是一篇老帖子,但经过一番搜索,我最终总是打开这个问题。正因为如此,我觉得分享解决这个问题的方法很好

    首先,我认为这是因为我改变了一些配置。主要是更改我使用的实现的一些版本,并更新kotlin版本。 我做的其他更改是将glide编译器的annotationProcessor更改为kapt

    因为错误是

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

    我以为是因为这个变化,但事实并非如此

    我所做的主要改变,甚至不认为这可能是一个问题,是将我的项目更新为JAVA 13

    为了解决这个问题,我将其改回Android Studio JDK:

    首先转到文件->项目结构See image for details

    接下来,在SDK位置选项卡(左侧)中,将JDK位置更改为“WhereYourAndroidStudio安装位置\Android Studio\jre”See image for details

    最后,重建项目,对我来说,这个错误消失了:

    See image for details