Gradle 3.0 error: compileDebugJavaWithJavac (cannot generate view binders java.lang.NullPointerException)

Hello @here,

I’m currently working in a project in Android (Android Studio) with several modules.
I did success by updating from gradle 2 to 3. I keep trying to improve the gradle config files for all of the modules.

I’m having the error mentioned in the topic title:

:app:compileDebugJavaWithJavac
error: cannot generate view binders java.lang.NullPointerException
at android.databinding.tool.store.SetterStore.getMatchingMultiAttributeSetters(SetterStore.java:642)
at android.databinding.tool.store.SetterStore.getMultiAttributeSetterCalls(SetterStore.java:529)
at android.databinding.tool.store.SetterStore.getBestGetter(SetterStore.java:938)
at android.databinding.tool.store.SetterStore.getGetterCall(SetterStore.java:778)
at android.databinding.tool.InverseBinding.setGetterCall(InverseBinding.java:110)
at android.databinding.tool.InverseBinding.(InverseBinding.java:58)
at android.databinding.tool.BindingTarget.addInverseBinding(BindingTarget.java:70)
at android.databinding.tool.LayoutBinder.(LayoutBinder.java:229)
at android.databinding.tool.DataBinder.(DataBinder.java:52)
at android.databinding.tool.CompilerChef.ensureDataBinder(CompilerChef.java:90)
at android.databinding.tool.CompilerChef.sealModels(CompilerChef.java:203)
at (…)
1 error

FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:compileDebugJavaWithJavac’.

Compilation failed; see the compiler error output for details.

I’m trying to improve the dependency conflicts by adding in the root gradle the resolution strategy to force to use the submodule libraries:

configurations.all {
    resolutionStrategy {
        force 'com.android.support.test.espresso:espresso-core:3.0.1',
                "com.android.support:support-v4:$project.ext.supportLibraryVersion",
                "com.android.support:support-vector-drawable:$project.ext.supportLibraryVersion",
                "com.android.support:animated-vector-drawable:$project.ext.supportLibraryVersion",
                "com.android.support:customtabs:$project.ext.supportLibraryVersion"
    }
}

In that way, I’m trying to avoid the exclusion of groups in the libraries that cause dependency problems (different versions of support libraries at compile / runtime):

implementation ("com.android.support:cardview-v7:$project.ext.supportLibraryVersion", {
    exclude group: 'com.android.support', module: 'support-vector-drawable'
})

The problem is, I don’t understand the relation between the new resolution strategy implemented and the data binding error raised. I couldn’t find anything related in this forum / stackoverflow / google (it’s true I can find discussions regarding compileDebugJavaWithJavac errors but nothing related to NullPointerException and view binders).
What am I missing? Am I misunderstanding the use of force in resolution strategy? I have the same error if I add the resolution strategy (force option) to every gradle file in every module (please note that the project was compiling without any errors and running normally before I added the new way of resolving dependencies).

Please note I’m not looking for a solution straight away, I would like to understand why that error is happening. Let me know if further information needed.
Thank you in advance.

Isaac.

As an UPDATE, I’m starting to believe this is a bug.