当我创建 Moshi 数据类时,任务 ':app:kaptDebugKotlin' 执行失败 [英] Execution failed for task ':app:kaptDebugKotlin' When I create Moshi Data Class
本文介绍了当我创建 Moshi 数据类时,任务 ':app:kaptDebugKotlin' 执行失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我创建 Moshi 数据类时,它没有正确构建以下是我尝试构建时的错误
When I create Moshi Data Class, It doesn't build properly The following is the Error when I try to build
Execution failed for task ':app:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
> java.lang.reflect.InvocationTargetException (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
这是我使用 Json 到 Kotlin 插件的数据类
This is my Data Class using Json to Kotlin Plugin
@JsonClass(generateAdapter = true)
data class FCMResponse(
@Json(name = "canonical_ids")
val canonicalIds: Int = 0,
@Json(name = "failure")
val failure: Int = 0,
@Json(name = "multicast_id")
val multicastId: Long = 0,
@Json(name = "results")
val results: List<Result> = listOf(),
@Json(name = "success")
val success: Int = 0
)
推荐答案
如果您使用的是 kotlin 1.5 版,请按如下方式更新依赖项:
if you're using kotlin version 1.5, update dependencies as follow:
- 房间到:2.3.0
- 匕首/刀柄:2.35.1
- Moshi 到:1.12.0
这篇关于当我创建 Moshi 数据类时,任务 ':app:kaptDebugKotlin' 执行失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文