原始kapt已过时 [英] Original kapt is deprecated
问题描述
我已将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: https://kotlinlang.org/docs/reference/kapt.html
源链接2: https://github.com/uber/NullAway/issues/75
Kotlin插件不会获取annotationProcessor
依赖项,因此我们必须将
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已过时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!