1、首先是Unresolved reference: databinding
这个东西。
折腾过程不说了,贴出项目的的build.gradle
buildscript {
ext.kotlin_version = '1.1.51'
ext.android_plugin_version = '3.0.0'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
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
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
maven { url 'https://dl.google.com/dl/android/maven2/' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
然后在module的build.gradle里加上
kapt {
generateStubs = true
}
2、编译之后,发现GlideApp找不到了,怎么都生成不了。难道这也是kotlin的锅?
好吧,既然java的注解生成不了,那么用kotlin来
//annotationProcessor 'com.github.bumptech.glide:compiler:4.2.0'
kapt 'com.github.bumptech.glide:compiler:4.2.0'
然后将glidemodule注解的java类改成kotlin类
按下CTRL+F9 make project
全部解决。