All of sudden I start getting this error, and I am not getting idea why if anyone just let me know where this error is, will be enough helpful. As much I am able to get is this because of new update of android studio. Detailed summary of error I am getting.
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
For me, a bunch of reference errors and an error in the XML expressions with
DataBinding
produced this error.I have deleted a
<variable/>
in alayout
file, because I thought, I don't need it anymore. I forgot that I had the variable referenced in thelayout
file.After building the project, this produced an error, where it was not possible to import the
BindingImpl
class, because it does not exist and this error was only shown as a warning parallel to the aboveKaptExecution
error.After searching for a while, I found this error and resolved it. Then, a bunch of reference errors where shown, because I renamed something and it did not rename it in the
Fragment
files. After resolving these errors too, the build finished for me without errors or warnings.Shout Out to @Rene Spies' answer above, I also got this error while working with databinding. It turns out the build engine doesn't like it when you put the
@Bindable
annotation on a field in the primary constructor of adata class
in Kotlin.So never do the following,
instead what you need to do is
Bonus: remember to check for same values before setting value to field if you are trying to use two-way binding like me to prevent infinite looping of setting and getting.
I got the same issue, so I tried to get more information, by doing
After this I got exact error saying "Error while annotation processing". I checked my recently tweaked DAO class and found that one of the method return type was not defined.
Change
To
If you have upgraded to classpath 'com.android.tools.build:gradle:4.0.0' Replace it previous version
And Change gradle-wrapper.properties
I had the same problem. Let me walk you through the example on how I ended up to the problem and the way I resolved it perhaps you can get a bigger picture.
Before resolving
In the DAO
The error I got was
So I dug deeper and found the below message
I removed the field IsUpdated from the POJO ModuleSession and added it to the session table
After changes
On the other hand crosscheck if there is any field on the
SELECT
statement that is a suspect causing issues or you can annotate it with@Ignore
However you can post your code if you're still not comfortable.
I hope that might help