我已将Kotlin版本更改为1.2.30.更新后,我无法运行该项目.我收到以下错误消息.
I have changed Kotlin version to 1.2.30. After the update I unable to run the project. I got the below error message.
Error:Execution failed for task ':app:compileDevDebugJavaWithJavac'. > app: Original kapt is deprecated. Please add "apply plugin: 'kotlin-kapt'" to your build.gradle.我该如何解决?
推荐答案
来源:使用Kotlin进行注释处理
Source: Annotation Processing with Kotlin
源链接1: kotlinlang/docs/reference/kapt.html
源链接2: github/uber/NullAway/issues/75
Kotlin插件不会获取annotationProcessor依赖项,因此我们必须将的kapt依赖项使用.
Kotlin plugin doesn't pick up annotationProcessor dependencies, So we have to use kapt dependencies with kotlin-kapt.
使用最新版本的Kotlin注释处理器,将此行放在模块级别build.gradle文件的顶部
Use the latest version of Kotlin annotation processor put this line at top of your module's level build.gradle file
apply plugin: 'kotlin-kapt'喜欢
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' // add this line android { compileSdkVersion 27 defaultConfig { ........ } }当您使用其他构建插件版本时,请不要忘记更新版本.
Don't forget to update the version when you use different build plugin version.
更多推荐
原始kapt已过时
发布评论