After adding
compile "android.arch.persistence.room:runtime:1.0.0-rc1"
all of my data binding classes are broken. Any clue?
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/
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With