Android Data Binding: missing DataBinderMapper class

java.lang.NoClassDefFoundError: android.databinding.DataBinderMapper
        at android.databinding.DataBindingUtil.<clinit>(DataBindingUtil.java:31)
        at com.example.MainActivity.onCreate(MainActivity.java:13)
        at android.app.Activity.performCreate(Activity.java:5231)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
        at android.app.ActivityThread.access$800(ActivityThread.java:135)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5001)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
        at dalvik.system.NativeStart.main(Native Method)

I hope this is a mistake, who is facing this problem? I unpacked classes.jarin a folder exploded-arr, but could not find the class DataBinderMapper.

Any workarounds / corrections would be appreciated.

+2
source share
4 answers

Make sure all of your modules using DataBinding are enabled. It is for this reason that I received this exception.

android {
....
dataBinding {
    enabled = true
}
}
+1
source

I encountered the same error. What I did was that I updated the dependency for data binding in the app.gradle file

kapt 'com.android.databinding:compiler:3.1.0-alpha05'

to

kapt 'com.android.databinding:compiler:3.2.0-alpha04'

databinder, . , , . , .

+1

android-apt build.gradle, android.databinding.DataBinderMapper.

build.gradle:

dependencies {
        classpath 'com.android.tools.build:gradle:1.3.1'
        classpath 'com.android.databinding:dataBinder:1.0-rc2'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
//.... more
}

build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'
apply plugin: 'com.neenbedankt.android-apt'

0

, , , , , , . , , - .

, , , ClassCastException, , . Binding LinearLayout RelativeLayout. - .

After making sure that there were no layouts that have the same name, even in different library modules, it cleared itself.

0
source

Source: https://habr.com/ru/post/1662372/


All Articles