突然我开始得到这个错误,我不知道为什么如果有人告诉我这个错误在哪里,就足够有帮助了。正如我所能得到的,这是因为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

当前回答

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

其他回答

对我来说,一堆引用错误和DataBinding XML表达式中的一个错误产生了这个错误。

我在布局文件中删除了<variable/>,因为我想,我不再需要它了。我忘了在布局文件中引用了变量。

在构建项目之后,这会产生一个错误,其中不可能导入BindingImpl类,因为它不存在,并且此错误仅显示为与上述KaptExecution错误并行的警告。

搜索了一段时间后,我发现了这个错误并解决了它。然后,一堆引用错误显示,因为我重命名了一些东西,它没有重命名它在片段文件。在解决了这些错误之后,我完成了构建,没有出现错误或警告。

尝试用

kapt.use.worker.api=false 

在你的gradle里。属性设置文件

参考:https://youtrack.jetbrains.com/issue/kt - 40750

解决了只需增加gradle版本到最新

它在项目级别的gradle文件中,在dependencies块下。

classpath "com.android.tools.build:gradle:4.x.x"

在我的情况下,我解决它更新我的kotlin版本从1.3。X到1.6.0。

如果你已经升级到类路径'com.android.tools.build:gradle:4.0.0' 替换之前的版本

dependencies {
    classpath 'com.android.tools.build:gradle:3.6.3'
}

和Change gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-   all.zip`