I'm getting an error in DataBindingMapperImpl.java for one specific data binding which results in the following error when building the project.
ANTLR Tool version 4.5.3 used for code generation does not match the current runtime version 4.7.1.
ANTLR 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.1
ANTLR Runtime version 4.5.3 used for parser compilation does not match the current runtime version 4.7.1
/Users/casper/Documents/ARCore/Name/app/build/generated/source/kapt/nameDebug/com/company/name/DataBinderMapperImpl.java:10: error: cannot find symbol
import com.company.name.databinding.ActivitySplashScreenBindingImpl;
^
symbol: class ActivitySplashScreenBindingImpl
> Task :app:kaptNameDebugKotlin FAILED
> Task :app:mergeExtDexNameDebug
location: package com.company.name.databinding
FAILURE: Build failed with an exception.
followed by the error message below...
I followed the similar post here which resulted in this, which is the end of the error message above.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:kaptNameDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
> java.lang.reflect.InvocationTargetException (no error message)
I have also tried
- Clean Project and then Rebuild project
- File -> Invalidate Caches / Restart
- Turn Android Studio on and off
The layout file connected to the data binding looks like this
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewmodel"
type="com.company.name.ui.splashScreen.viewModel.SplashScreenViewModel"/>
<variable
name="tryAgainBtnHandler"
type="com.company.name.ui.splashScreen.viewModel.interfaces.TryAgainBtnHandler"/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.splashScreen.view.SplashScreenActivity">
Solution
The error was caused by a mistake. I did set visibility by
android:visibility="@{viewmodel.errorContainerVisible ? View.VISIBLE : View.GONE}"
and forgot to import
<data>
<import type="android.view.View"/>