Android Room and Data Binding compile-time errors

I’m building things with a combination of the new Room ORM and Data Binding, and I find that when Room has compile errors they express as hundreds of lines of Error:(6, 31) error: cannot find symbol class BR and related things, and no actual real error.

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