在module中的build.gradle添加kotlin的依赖
buildscript { repositories { jcenter() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } }
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
再添加对android的支持
apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions'
-
1
-
2
-
3
-
1
-
2
-
3
再添加java的编译路径,在main下创建kotlin目录 并在gradle文件写上
完整的build.gradle如下
buildscript { repositories { jcenter() } dependencies { classpath "org.jetbrains.k