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

theopaintsil

10/30/2019, 4:19 PM
is anybody else having issues with ButterKnife?
🚫 4
c

Casey Brooks

10/30/2019, 4:21 PM
Butterknife doesn’t really work in Kotlin code (something with kapt? IDK). Just use the synthetic imports from Kotlin Android Extensions, or the new view-binding feature https://developer.android.com/topic/libraries/view-binding
t

theopaintsil

10/30/2019, 4:31 PM
thanks
g

gildor

10/30/2019, 4:36 PM
Bitterknife does work with Kotlin code, and yes, you need kapt for this (as for any annotation processor who want to read Kotlin code)
t

theopaintsil

10/30/2019, 4:38 PM
"The given artifact contains a string literal with a package reference 'android.support.v4' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx. "
g

gildor

10/30/2019, 4:39 PM
But I personally wouldn't recommend to use neither Butterknife nor Kotlin Android Extensions.
Both are deprecated on practice (or at least do not evolve)
t

theopaintsil

10/30/2019, 4:40 PM
@gildor what will you recommend?
g

gildor

10/30/2019, 4:41 PM
Depends on what you need. Probably ViewBindings, but they are on early stage of development and you need beta version of AGP
t

theopaintsil

10/30/2019, 4:42 PM
i have already used ButterKnife but i am having this issue today
The given artifact contains a string literal with a package reference 'android.support.v4' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.
g

gildor

10/30/2019, 4:42 PM
Are you sure that you use a new version of Butterknife? It's an issue with androidx. It was fixed a long time ago
j

jw

10/30/2019, 4:44 PM
Make sure you're on 10.2.0
👍 1
Or, migrate to view binding 😁
👍 1
p

pavi2410

10/30/2019, 11:09 PM
Or wait for Jetpack Compose 😁😁
t

theopaintsil

10/31/2019, 8:16 AM
thanks for the help
very much appreciated
the 10.2.0 worked
6 Views