AndroidStudio 配置Kotlin

1、下载插件

AndroidStudio 配置Kotlin_第1张图片

2、在项目的Gralde中配置:

buildscript {
    ext.kotlin_version = '1.1.2-5'
    ext.kotlin_version = '1.1.2-4'
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

3、在app的Gradle中配置如下

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

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

你可能感兴趣的:(kotlin)