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 bug, does anyone face a similar problem? I unzipped classes.jar
under the exploded-arr
folder, but couldn't find the DataBinderMapper
class.
Any workarounds / fixes would be appreciated.
android {
...
dataBinding {
enabled = true
}
}
You should include the android-apt plugin in your build.gradle in order to generate the android.databinding.DataBinderMapper
class.
In your project 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
}
In each module build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'
apply plugin: 'com.neenbedankt.android-apt'
More information
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With