Hi can anyone help me how to solve this error " ca...
# android
a
Hi can anyone help me how to solve this error " cannot find symbol" when using the data binding
g
Show the full error message
a
Task appcompileDevDebugJavaWithJavac FAILED D\android kotlin group call\app\src\main\java\com\appScrip\myapplication\dashboard\UsersListAdapter.java16: error: cannot find symbol implements CustomClickListener { ^ symbol: class CustomClickListener D\android kotlin group call\app\build\generated\data binding base class source out\devDebug\dataBindingGenBaseClassesDevDebug\out\com\appscrip\myapplication\databinding\ItemUserBinding.java13: error: cannot find symbol import com.appScrip.myapplication.dashboard.CustomClickListener; ^ symbol: class CustomClickListener location: package com.appScrip.myapplication.dashboard D\android kotlin group call\app\build\generated\data binding base class source out\devDebug\dataBindingGenBaseClassesDevDebug\out\com\appscrip\myapplication\databinding\ItemUserBinding.java27: error: cannot find symbol protected CustomClickListener mItemClickListener; ^ symbol: class CustomClickListener location: class ItemUserBinding D\android kotlin group call\app\build\generated\data binding base class source out\devDebug\dataBindingGenBaseClassesDevDebug\out\com\appscrip\myapplication\databinding\ItemUserBinding.java42: error: cannot find symbol public abstract void setItemClickListener(@Nullable CustomClickListener itemClickListener); ^ symbol: class CustomClickListener location: class ItemUserBinding D\android kotlin group call\app\build\generated\data binding base class source out\devDebug\dataBindingGenBaseClassesDevDebug\out\com\appscrip\myapplication\databinding\ItemUserBinding.java45: error: cannot find symbol public CustomClickListener getItemClickListener() { ^ symbol: class CustomClickListener location: class ItemUserBinding D\android kotlin group call\app\build\generated\source\kapt\devDebug\com\appscrip\myapplication\databinding\ItemUserBindingImpl.java85: error: cannot find symbol public void setItemClickListener(@Nullable com.appScrip.myapplication.dashboard.CustomClickListener ItemClickListener) { ^ symbol: class CustomClickListener location: package com.appScrip.myapplication.dashboard D\android kotlin group call\app\build\generated\source\kapt\devDebug\com\appscrip\myapplication\databinding\ItemUserBindingImpl.java69: error: cannot find symbol setItemClickListener((com.appScrip.myapplication.dashboard.CustomClickListener) variable); ^ symbol: class CustomClickListener location: package com.appScrip.myapplication.dashboard D\android kotlin group call\app\build\generated\source\kapt\devDebug\com\appscrip\myapplication\databinding\ItemUserBindingImpl.java109: error: cannot find symbol com.appScrip.myapplication.dashboard.CustomClickListener itemClickListener = mItemClickListener; ^ symbol: class CustomClickListener location: package com.appScrip.myapplication.dashboard D\android kotlin group call\app\build\generated\source\kapt\devDebug\com\appscrip\myapplication\databinding\ItemUserBindingImpl.java140: error: cannot find symbol com.appScrip.myapplication.dashboard.CustomClickListener itemClickListener = mItemClickListener; ^ symbol: class CustomClickListener location: package com.appScrip.myapplication.dashboard
but it is working when it is in java
g
Looks that it cannot find class CustomClickListener, but hard to say without sources, most probably there are some incompatible changes in Kotlin code but not in binding code
n
Are you importing
CustomClickListener
in the data block of your layout? No idea why this would work in Java and not Kotlin though
Copy code
<import type="com.appScrip.myapplication.dashboard.CustomClickListener" />