NoClassDefFoundError - Failed resolution of: Landroidx/databinding/DataBinderMapperImpl;

2021-03-21 18:55:16.105 9214-9214/com.amity.samples E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.amity.samples, PID: 9214
    java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/databinding/DataBinderMapperImpl;
        at androidx.databinding.DataBindingUtil.<clinit>(DataBindingUtil.java:32)
        at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:95)
        at com.ekoapp.ekosdk.uikit.community.home.fragments.EkoCommunityHomePageFragment.onCreateView(EkoCommunityHomePageFragment.kt:67)
        at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2907)
        at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:488)
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1296)
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1442)
        at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1520)
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1573)
        at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:454)
        at androidx.fragment.app.FragmentManager.executeOps(FragmentManager.java:2297)
        at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2082)
        at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2020)
        at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1922)
        at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:486)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7660)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.databinding.DataBinderMapperImpl" on path: DexPathList[[zip file "/data/app/~~iFdJawqh5xb18KoH36BAEQ==/com.amity.samples-SasY2pZxebE1pyL_jMSE8g==/base.apk"],nativeLibraryDirectories=[/data/app/~~iFdJawqh5xb18KoH36BAEQ==/com.amity.samples-SasY2pZxebE1pyL_jMSE8g==/lib/arm64, /system/lib64, /system_ext/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at androidx.databinding.DataBindingUtil.<clinit>(DataBindingUtil.java:32) 
        at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:95) 
        at com.ekoapp.ekosdk.uikit.community.home.fragments.EkoCommunityHomePageFragment.onCreateView(EkoCommunityHomePageFragment.kt:67) 
        at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2907) 
        at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:488) 
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1296) 
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1442) 
        at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1520) 
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1573) 
        at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:454) 
        at androidx.fragment.app.FragmentManager.executeOps(FragmentManager.java:2297) 
        at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2082) 
        at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2020) 
        at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1922) 
        at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:486) 
        at android.os.Handler.handleCallback(Handler.java:938) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:223) 
        at android.app.ActivityThread.main(ActivityThread.java:7660) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975) 

The error indicates that your project couldn’t find the ‘DataBinder’ classes. This might occur because of the missing configurations on your project. You will need to enable a ‘DataBinding’ feature in your application’s Gradle by following these steps.

  1. Navigate to ‘build.gradle’ in the application level.
  2. In the ‘android’ configuration level please put
    buildFeatures { dataBinding = true }

at the end it would look like this