Android Studio 集成Kotlin遇到的错误

来源:互联网 发布:python运维流程系统 编辑:程序博客网 时间:2024/05/16 19:01

1.Error:Execution failed for task ‘:app:compileDebugKotlin’

Error:Execution failed for task ':app:compileDebugKotlin'. > Compilation error. See log for more details

多的不说,旨在解决问题

首先你需要确认你的配置写的是否完整

参考官方文档

https://kotlinlang.org/docs/tutorials/kotlin-android.html

1)、module.build中添加

apply plugin: 'kotlin-android'apply plugin: 'kotlin-android-extensions'dependencies {    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"}

2)、project.build中添加

    buildscript {    //添加    ext.kotlin_version = "1.1.51"    repositories {        jcenter()        maven { url "https://jitpack.io" }    }    dependencies {        classpath 'com.android.tools.build:gradle:3.0.1'        // NOTE: Do not place your application dependencies here; they belong        // in the individual module build.gradle files        //添加        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"        classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"    }}