错误:任务 ':app:kaptDebugKotlin' 的执行失败 [英] Error:Execution failed for task ':app:kaptDebugKotlin'

查看:43
本文介绍了错误:任务 ':app:kaptDebugKotlin' 的执行失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用 Kotlin 并尝试使用 Dagger2 进行设置,我看过一些示例,但似乎没有一个对我有用.

I'm new to using Kotlin and trying to set it up with Dagger2, I've seen some few examples but none of them seem to work for me.

我一直收到这个

错误:任务:app:kaptDebugKotlin"的执行失败.

Error:Execution failed for task ':app:kaptDebugKotlin'.

内部编译器错误.详情见日志

Internal compiler error. See log for more details

我有我的 build.gradle(模块:app)

I have my build.gradle (Module: app)

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

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.exampleapp"
        minSdkVersion 14
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    kapt {
        generateStubs = true
    }
    dexOptions {
        javaMaxHeapSize "2048M"
    }
}

ext {
    supportLibVer = '25.0.0'
    daggerVer = '2.8'
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    // Support lib
    compile "com.android.support:appcompat-v7:${supportLibVer}"

    kapt "com.google.dagger:dagger-compiler:${daggerVer}"
    compile "com.google.dagger:dagger:${daggerVer}"
    provided "javax.annotation:jsr250-api:${javaxVer}"

    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"


}
repositories {
    mavenCentral()
}

推荐答案

使用 ./gradlew clean build 命令运行您的应用程序以查看您的代码到底有什么问题.只需将其粘贴到 Android Studio 的终端中即可.

Run your application with ./gradlew clean build command to see what's exactly wrong with your code. Just paste it into the Terminal in Android Studio.

这篇关于错误:任务 ':app:kaptDebugKotlin' 的执行失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆