原始kapt已过时

编程入门 行业动态 更新时间:2024-10-17 07:34:58
本文介绍了原始kapt已过时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已将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已过时

本文发布于:2023-07-17 03:24:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1128946.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:原始   kapt

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!