突然我开始得到这个错误,我不知道为什么如果有人告诉我这个错误在哪里,就足够有帮助了。正如我所能得到的,这是因为android studio的新更新。 我得到的错误的详细总结。

Task :app:kaptDebugKotlin
    ANTLR Tool version 4.5.3 used for code generation does not match the current runtime version 4.7.1ANTLR Runtime version 4.5.3 used for parser compilation does not match the current runtime version 4.7.1ANTLR Tool version 4.5.3 used for code generation does not match the current runtime version 4.7.1ANTLR Runtime version 4.5.3 used for parser compilation does not match the current runtime version 4.7.1C:\Users\shubh\Downloads\MarginCalculator\app\build\generated\source\kapt\debug\com\kotlin_developer\margincalculator\DataBinderMapperImpl.java:10: error: cannot find symbol
    import com.kotlin_developer.margincalculator.databinding.FragmentCalculatorScreenBindingImpl;

    symbol:   class FragmentCalculatorScreenBindingImpl

    Task :app:kaptDebugKotlin FAILED
    location: package com.kotlin_developer.margincalculator.databinding
    FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
   > 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.

* Get more help at https://help.gradle.org

BUILD FAILED in 17s
29 actionable tasks: 27 executed, 2 up-to-date

当前回答

在我的情况下,我使用房间和我的一个databasDao方法有一个未使用的参数,不幸的是android工作室没有正确地警告我

其他回答

检查柯特林和刀柄的兼容版本

我花了几天时间才找到这个问题的解决方案,使用了androidx的高级版本。生命周期:lifecycle-compiler插件。

实现“androidx.lifecycle: lifecycle-runtime: 2.2.0-alpha03”

kapt androidx.lifecycle: lifecycle-compiler: 2.2.0-alpha03

kapt "android.arch.lifecycle:compiler:1.1.1"

在我的情况下,我只是重命名/settings.gradle中的rootProject.name 我再次重复这个动作,它的工作..我不明白为什么会发生这种事,但我希望这能帮助到其他人,节省他们的时间

Android Studio的UI只是隐藏了错误……

当错误发生时,它会突出显示列表视图中的项目,并在终端视图中显示一条无用的消息。

要找到真正的错误,在列表视图中选择根项,这样Android Studio就会在终端视图中显示整个构建输出,然后滚动以找到错误。

在我的例子中,我添加了这一行

 android {
    .
    .
    .

    kapt.includeCompileClasspath = false

 }