andronil
andronil

Reputation: 1

kapt compiler issue in studio 3.2.1 with data binding and room

Build fails with error "cannot find symbol DataBindingComponent" in all generated binding classes.If I remove the room compiler dependency from my module gradle, then it unable to find room db at run time saying "Db_Impl does not exist".

def room_version = "1.1.1"
implementation "android.arch.persistence.room:runtime:$room_version"
//kapt "android.arch.persistence.room:compiler:$room_version"
//kapt 'com.android.databinding:compiler:3.2.1'  

Upvotes: 0

Views: 578

Answers (3)

Gajendra_kumar
Gajendra_kumar

Reputation: 19

dependencies { def room_version = "2.1.0-alpha06"

implementation "androidx.room:room-runtime:1.1.1"
annotationProcessor "androidx.room:room-compiler:1.1.1" // For Kotlin use kapt instead of annotationProcessor

// optional - Kotlin Extensions and Coroutines support for Room
implementation "androidx.room:room-ktx:1.1.1"

// optional - RxJava support for Room
implementation "androidx.room:room-rxjava2:1.1.1"

// optional - Guava support for Room, including Optional and ListenableFuture
implementation "androidx.room:room-guava:1.1.1"

// Test helpers
testImplementation "androidx.room:room-testing:1.1.1"

}

Upvotes: 1

rohiththammaiah
rohiththammaiah

Reputation: 153

You are missing kotlin's annotation processor plugin. Add this to the top of your app level gradle file

apply plugin: 'kotlin-kapt'

and uncomment the data binding dependency. Sync after this.

Upvotes: 0

Infusion Analysts
Infusion Analysts

Reputation: 489

Try this.. add this dependency into app level gradle file.

    implementation "android.arch.persistence.room:runtime:1.1.1"
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"

more information refer this link https://www.simplifiedcoding.net/android-room-database-example/

Upvotes: 0

Related Questions