ANTLR Tool version 4.7.1 used for code generation does not match the current runtime version 4.5.3

后端 未结 6 1589
别那么骄傲
别那么骄傲 2021-02-19 23:10

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

相关标签:
6条回答
  • 2021-02-19 23:43

    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

    0 讨论(0)
  • 2021-02-19 23:43

    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"
    
    0 讨论(0)
  • 2021-02-19 23:47

    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" }

    0 讨论(0)
  • 2021-02-19 23:48

    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()
    }
    
    0 讨论(0)
  • 2021-02-19 23:49

    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)
    
    0 讨论(0)
  • 2021-02-19 23:51

    Removing suspend keyword from queries in DAO interface, solved my problem

    0 讨论(0)
提交回复
热议问题