NoClassDefFoundError: Landroid/databinding/DataBinderMapperImpl

databinding使用过程中出现以下bug,很是麻烦 .

Process: xxxx.xxx.xxx, PID: 9486
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/databinding/DataBinderMapperImpl;
at android.databinding.DataBindingUtil.(DataBindingUtil.java:32)
at android.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:284)
at com.panic.modulelib.base.activity.BaseActivity.onCreate(BaseActivity.java:58)
at android.app.Activity.performCreate(Activity.java:7372)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1218)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3147)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3302)
at android.app.ActivityThread.-wrap12(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1891)
at android.os.Handler.dispatchMessage(Handler.java:108)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7425)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.databinding.DataBinderMapperImpl" on path: DexPathList[[zip file "/data/app/com.panic.demoone-W43esf4GPQ7LOQ-VfsbL5g==/base.apk", zip file "/data/app/com.panic.demoone-W43esf4GPQ7LOQ-VfsbL5g==/split_lib_dependencies_apk.apk", zip file "/data/app/com.panic.demoone-W43esf4GPQ7LOQ-VfsbL5g==/split_lib_resources_apk.apk", zip file "/data/app/com.panic.demoone-W43esf4GPQ7LOQ-VfsbL5g==/split_lib_slice_0_apk.apk", zip file "/data/app/com.panic.demoone-W43esf4GPQ7LOQ-VfsbL5g==/split_lib_slice_1_apk.apk", zip file "/data/app/com.panic.demoone-W43esf4GPQ7LOQ-VfsbL5g==/split_lib_slice_2_apk.apk", zip file "/data/app/com.panic.demoone-W43esf4GPQ7LOQ-VfsbL5g==/split_lib_slice_3_apk.apk", zip file "/data/app/com.panic.demoone-W43esf4GPQ7LOQ-VfsbL5g==/split_lib_slice_4_apk.apk", zip file "/data/app/com.panic.demoone-W43esf4GPQ7LOQ-VfsbL5g==/split_lib_slice_5_apk.apk", zip file "/data/app/com.panic.demoone-W43esf4GPQ7LOQ-VfsbL5g==/split_lib_slice_6_apk.apk", zip file "/data/app/com.panic.demoone-W43esf4GPQ7LOQ-VfsbL5g==/split_lib_slice_7_apk.apk", zip file "/data/app/com.panic.demoone-W43esf4GPQ7LOQ-VfsbL5g==/split_lib_slice_8_apk.apk", zip file "/data/app/com.panic.demoone-W43esf4GPQ7LOQ-VfsbL5g==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.panic.demoone-W43esf4GPQ7LOQ-VfsbL5g==/lib/arm64, /system/lib64, /vendor/lib64, /product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.databinding.DataBindingUtil.(DataBindingUtil.java:32) 
at android.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:284) 
at com.panic.modulelib.base.activity.BaseActivity.onCreate(BaseActivity.java:58) 
at android.app.Activity.performCreate(Activity.java:7372) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1218) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3147) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3302) 
at android.app.ActivityThread.-wrap12(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1891) 
at android.os.Handler.dispatchMessage(Handler.java:108) 
at android.os.Looper.loop(Looper.java:166) 
at android.app.ActivityThread.main(ActivityThread.java:7425) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921) 
Suppressed: java.io.IOException: No original dex files found for dex location /data/app/com.panic.demoone-W43esf4GPQ7LOQ-VfsbL5g==/split_lib_resources_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:353)
at dalvik.system.DexFile.(DexFile.java:100)
at dalvik.system.DexFile.(DexFile.java:74)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337)
at dalvik.system.DexPathList.(DexPathList.java:157)
at dalvik.system.BaseDexClassLoader.(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.(PathClassLoader.java:64)
at com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:75)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:38)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:716)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:749)
at android.app.LoadedApk.getResources(LoadedApk.java:996)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2489)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6398)
at android.app.ActivityThread.-wrap2(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1963)
... 6 more

解决办法:主要原因是该项目是组件式开发,在某个module中未添加

    dataBinding{
        enabled = true
    }

检查module,在gradle中添加以上代码能顺利解决.

你可能感兴趣的:(Android开发技术,python,opencv,开发语言,NoClassDefFound,Landroid,databinding,MapperImpl)