I got the error after making the project:
FAILURE: Build failed with an exception.
The following command worked for me.
./gradlew assembleDebug --rerun-tasks
I had the same error at build time and it was caused by a binding variable (that declared inside <data></data> with a Java reserved word as name. For instance <variable name="case" type="com.mydomain.Case" />
<data></data>
<variable name="case" type="com.mydomain.Case" />