Execution failed for task ':app:kaptDebugKotlin'问题记录

2021-08-24 Views bug记录 android

我的项目中添加了单元测试相关的库,在kaptDebugKotlin时提示运行失败,截图如下:

image.png
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)

查看项目中使用kapt的库是Room相关的:kapt "androidx.room:room-compiler:$roomVersion"

这个问题也是添加了Room后出现了,因此怀疑是Room相关的代码和我Studio环境有关。

解决也很简单:修改Studio的JAVA环境,将原来的zulu-8.jdk改为Android Studio JAVA Home

image.png

赏 支付宝扫码打赏 微信打赏

△