Reputation: 1554
After adding
compile "android.arch.persistence.room:runtime:1.0.0-rc1"
all of my data binding classes are broken. Any clue?
Upvotes: 7
Views: 1897
Reputation: 2777
As others have stated, the issue is not with your Data Binding classes/setup, but rather an error somewhere in your Room annotations. In my case, it was an error with the DAO class. If you're on an old version of the gradle plugin, You see all of the Data Binding compiler errors before getting the room compiler errors, which is the error that points to the actual issue in your Room code.
This was fixed in the 3.4 Android Gradle plugin, so you can now update to that (this requires Android Studio 3.4 or higher). It'll prompt you to update the Android gradle plugin the first time you open the project:
More information (including the code to print out all of the compiler errors) here.
Upvotes: 1
Reputation: 1728
I had the same issue. After spending hours on this, I finally fixed my error by replacing LiveData<ArrayList<MovieFavEntity>>
to LiveData<List<MovieFavEntity>>
.
Just check the return type and queries of the different method in the Dao.
Upvotes: 0
Reputation: 1554
Turns out, javac will print a maximum of 100 compilation errors, and when dealing with preprocessors you often want the last error message, not the first. Put this in your top-level build.gradle file and become happy:
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xmaxerrs" << "4000"
options.compilerArgs << "-Xmaxwarns" << "4000"
}
}
}
Thanks to: https://movieos.org/2017/android-room-data-binding-compile-time-errors/
Upvotes: 14