https://kotlinlang.org logo
#android
Title
# android
a

Akbar

09/09/2019, 1:00 PM
Hi can anyone help me how to solve this error " cannot find symbol" when using the data binding
g

gildor

09/09/2019, 2:07 PM
Show the full error message
a

Akbar

09/09/2019, 2:12 PM
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

gildor

09/09/2019, 3:00 PM
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

Nate

09/10/2019, 12:23 AM
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" />
5 Views