https://kotlinlang.org logo
Title
a

alouanemed

08/10/2017, 1:22 PM
Do I have to change something in order for butterknife work with kotlin ? I am getting this err : Caused by: kotlin.UninitializedPropertyAccessException: lateinit property introIndicator0 has not been initialized
@BindView( R.id.imageview_welcome_intro_indicator_0) lateinit var introIndicator0: ImageView
k

kingsley

08/10/2017, 1:23 PM
Did you forget to call
ButterKnife#bind
?
a

alouanemed

08/10/2017, 1:23 PM
I have it inside the BaseActivity
The code works fine before converting to kotlin
k

kingsley

08/10/2017, 1:25 PM
Perhaps you are attempting to use the variable before the base activity has had the chance to initialize it then
Also, did you change
annotationProcessor
in Gradle to
kapt
?
a

alouanemed

08/10/2017, 1:26 PM
no
in gradle, right ?
and how to do so ?
k

kingsley

08/10/2017, 1:28 PM
There lies the problem then. Kotlin has it’s own annotation processor that should be applied instead of Android’s
annotationProcessor
. Just change all
annotationProcessor
to
kapt
and apply the kapt plugin.
apply plugin: kotlin-kapt
r

rkeazor

08/10/2017, 4:02 PM
Why not just use Android Extensions?
@alouanemed were are you doing your bind(this) at?
r

radityagumay

08/14/2017, 5:39 PM
Using butterknife in kotlin is not a wise. Consider using synthetic