1

have used Data binding in my existing code and now I am migrating to Room for persistence. My Code builds fine without java code error or BR related error when I remove room dependency

 annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'

and its runs too, but gives Runtime exception saying AppDatabase_Impl does not exists. As it couldn't generate that's file.

But after I put Annotation processor back, it give me

error: cannot find symbol class BR

My project level build.gradle:-

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'com.android.tools.build:gradle:3.2.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
        maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local' }

        flatDir {
            dirs 'libs'
        }
    }
}

I added below room dependency:-

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

I tried clear cache and rebuild.I also check this answer but it not help me

Has anyone used Room and Data binding together ?

Anand Jain
  • 2,365
  • 7
  • 40
  • 66

0 Answers0