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


(Isaac Lopez) #1

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:

error: cannot generate view binders java.lang.NullPointerException
at android.databinding.tool.InverseBinding.setGetterCall(
at android.databinding.tool.InverseBinding.(
at android.databinding.tool.BindingTarget.addInverseBinding(
at android.databinding.tool.LayoutBinder.(
at android.databinding.tool.DataBinder.(
at android.databinding.tool.CompilerChef.ensureDataBinder(
at android.databinding.tool.CompilerChef.sealModels(
at (…)
1 error


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 '',

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 ("$project.ext.supportLibraryVersion", {
    exclude group: '', 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.


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