构建Kotlin项目时报错如下: Execution failed for task ':app:kaptDebugKotlin'.> A failure occurred while executi
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)
错误: cannot generate view binders java.lang.NullPointerException at Android.databinding.tool.store.SetterStore.calculateConversionPriority(SetterStore.java:995) at android.databinding.tool.store.SetterStore.isBetterParameter(SetterStore.java:890) at android.databinding.tool.store.SetterStore.getBestSetter(SetterStore.java:750) at android.databinding.tool.store.SetterStore.getSetterCall(SetterStore.java:572) at android.databinding.tool.Binding.getListenerParameter(Binding.java:175) at android.databinding.tool.Binding.resolveCallbackParams(Binding.java:77) at android.databinding.tool.BindingTarget.resolveCallbackParams(BindingTarget.java:179) at android.databinding.tool.LayoutBinder.(LayoutBinder.java:142) at android.databinding.tool.DataBinder.(DataBinder.java:61) at android.databinding.tool.CompilerChef.ensureDataBinder(CompilerChef.java:118) at android.databinding.tool.CompilerChef.sealModels(CompilerChef.java:370)
这是说ViewDataBinding有问题,检查XML文件是否有引用错误的地方。
排除掉代码层面和xml层面的问题之后,考虑这种问题多半是版本不匹配造成的。一般按照以下步骤排查即可解决:
具体的版本对应地址
gradle插件版本在根目录的build.gradle
中的buildscript{}
中查看得到
gradle版本在gradle/wrapper/gradle-wrapper.properties
中查看得到
kotlin插件版本在根目录的
build.gradle
中的buildscript{}
中查看得到
AS的kotlin版本在File | Settings | Languages & Frameworks | Kotlin
中查看得到
File | Settings | Build, Execution, Deployment | Build Tools | Gradle
中的Gradle JDK
选择合适的版本Embedded JDK
举个例子
Kotlin-Version = 1.6.0 => Room-Version = 2.4.2
来源地址:https://blog.csdn.net/jxq1994/article/details/129880109
--结束END--
本文标题: 解决A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask
本文链接: https://lsjlt.com/news/407275.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-01-21
2023-10-28
2023-10-28
2023-10-27
2023-10-27
2023-10-27
2023-10-27
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0