Im working on an Android App, currently using DSL and some libraries, suddenly the build gave me this error.
Task :app:kaptDebugKotlin FAILED ANTLR Tool
For anyone still experiencing this issue, just update your Room to the latest version:
androidx.room:room-runtime:2.3.0-alpha04
androidx.room:room-compiler:2.3.0-alpha04
It's due to this bug: https://issuetracker.google.com/issues/155215201
The problem was fixed for me by changing this. from:
implementation "androidx.room:room-runtime:$depVersion"
implementation "androidx.room:room-compiler:$depVersion"
to:
implementation "androidx.room:room-runtime:$depVersion"
annotationProcessor "androidx.room:room-compiler:$depVersion"
Inside the build.gradle(Module:app) copypaste this code
configurations.all() {
resolutionStrategy.force "org.antlr:antlr4-runtime:4.5.3"
resolutionStrategy.force "org.antlr:antlr4-tool:4.5.3"
}
Had a similar issue. I was trying to implement bindingAdapters to a TextView of a ViewHolder in my recyclerview
I failed to implement a bindingAdapter for a TextView after adding the adding a unique app attribute
app:tDate="@{transaction}
in the xml layout file for my recylerView item.
<TextView
android:id="@+id/trans_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/trans_category"
app:layout_constraintTop_toTopOf="parent"
app:tDate="@{transaction}"/>
Solved it by well.. implementing it.
@BindingAdapter("tDate")
fun TextView.setValue(item: Transactions){
text = item.date.toString()
}
So the solution was from the build.gradle
basically the import from ROOM was this
import(Room.compiler)
so i changed to this, and the issue was solved :)
kapt(Room.compiler)
Removing suspend keyword from queries in DAO interface, solved my problem