Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoClassDefFoundError: for DataBinderMapper even after enabling data binding #220

Closed
AkshayChordiya opened this issue Jul 8, 2017 · 14 comments

Comments

@AkshayChordiya
Copy link

AkshayChordiya commented Jul 8, 2017

I'm facing this critical crash even after adding this

android {
    ....
    dataBinding {
        enabled = true
    }
}

Project Setup:
Using Android 3.0 Canary 5 with Kotlin and new Android architecture components

@heinrichreimer
Copy link
Owner

Is this related to #198? Which library and Android versions are you using? Is there a specific compiler error? If so, please post the full error log.

@AkshayChordiya
Copy link
Author

Yeah it's related to #198 even after solving it. I am facing crash.

Details:
Library version: v1.6.2
Android version: 6.0.1 (Marshmallow)

Full error log:

FATAL EXCEPTION: main
                                                                               Process: com.bitfurther.notigo.teacher, PID: 23955
                                                                               java.lang.NoClassDefFoundError: Failed resolution of: Landroid/databinding/DataBinderMapper;
                                                                                   at android.databinding.DataBindingUtil.<clinit>(DataBindingUtil.java:31)
                                                                                   at com.heinrichreimersoftware.materialintro.app.IntroActivity.onCreate(IntroActivity.java:198)
                                                                                   at com.bitfurther.notigo.teacher.ui.activity.BoardingActivity.onCreate(BoardingActivity.kt:16)
                                                                                   at android.app.Activity.performCreate(Activity.java:6251)
                                                                                   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                                                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                                                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                                                   at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                                                   at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                   at android.os.Looper.loop(Looper.java:148)
                                                                                   at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                                Caused by: java.lang.ClassNotFoundException: Didn't find class "android.databinding.DataBinderMapper" on path: DexPathList[[zip file "/data/app/com.bitfurther.notigo.teacher-1/base.apk"],nativeLibraryDirectories=[/data/app/com.bitfurther.notigo.teacher-1/lib/arm, /vendor/lib, /system/lib]]
                                                                                   at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                                                   at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                                                   at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                                                                   at android.databinding.DataBindingUtil.<clinit>(DataBindingUtil.java:31) 
                                                                                   at com.heinrichreimersoftware.materialintro.app.IntroActivity.onCreate(IntroActivity.java:198) 
                                                                                   at com.bitfurther.notigo.teacher.ui.activity.BoardingActivity.onCreate(BoardingActivity.kt:16) 
                                                                                   at android.app.Activity.performCreate(Activity.java:6251) 
                                                                                   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
                                                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                                                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                                                   at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                                                   at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                   at android.os.Looper.loop(Looper.java:148) 
                                                                                   at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                                   at java.lang.reflect.Method.invoke(Native Method) 
                                                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                                                               	Suppressed: java.lang.ClassNotFoundException: android.databinding.DataBinderMapper
                                                                                   at java.lang.Class.classForName(Native Method)
                                                                                   at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                                                                                   at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                                                                                   at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                                                                                   		... 16 more
                                                                                Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

@AkshayChordiya
Copy link
Author

@heinrichreimer Need more data?

@whywilson
Copy link

Hi, @AkshayChordiya. Are you Using AIDE to compile and issue like this happen? It happens to me for several weeks, Android Studio is OK, but AIDE still occurred with this log.

@AkshayChordiya
Copy link
Author

@wilsonqq I'm using Android Studio 3.0 Canary 5 and now 6. Still it's showing the same issue. I'll add some more code to debug the issue.

@daniel-stoneuk
Copy link
Collaborator

daniel-stoneuk commented Jul 14, 2017

@AkshayChordiya Try adding android.enableAapt2=false to your gradle.properties file.

There seems to be issues with the new Aapt compiler in AS 3.0, this should fix it.

@kolbasan
Copy link

I am having the same issue, I am using similar setup, AS 3.0 Canary 6.
Setting android.enableAapt2=false didn't fix the issue.

@AkshayChordiya
Copy link
Author

@daniel-stoneuk Tried it, didn't work. Same crash issue.

@daniel-stoneuk
Copy link
Collaborator

@kolbasan @AkshayChordiya Ah damn, sorry. I presume you've had a Google to see whether it's solvable. I wonder whether this is an issue that should be resolved in the library, or if it's an external issue.

@AkshayChordiya
Copy link
Author

AkshayChordiya commented Jul 18, 2017

Solved the issue by adding the following things to app build.gradle

  1. Enabling Data Binding
android {
    ....
    dataBinding {
        enabled = true
    }
}
  1. Adding dependency
dependencies {
    kapt 'com.android.databinding:compiler:2.3.3'
    ....
}

Using kapt for Kotlin.

@tasomaniac
Copy link

Same error happened to be but the compiler dependency is not available anymore for Gradle plugin version 3.2

@jwc123
Copy link

jwc123 commented Feb 2, 2019

Same error happened to be but the compiler dependency is not available anymore for Gradle plugin version 3.2

i had the wrong error when i upgrade the gradle plugin version to 3.2.Do you fix it?

@chimbori
Copy link
Collaborator

This is not really fixed. If using the setup instructions provided in the README still cause this for many users, then either this missing dependency should be added to this library, or else the README should be updated because this bug can be marked fixed.

@naimur20
Copy link

Hi, @AkshayChordiya. Are you Using AIDE to compile and issue like this happen? It happens to me for several weeks, Android Studio is OK, but AIDE still occurred with this log.

AIDE can not generate DataBinding classes even after enabling databinding in build.gradle. Can you use databinding in AIDE?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants