is anybody else having issues with ButterKnife?
# android
t
is anybody else having issues with ButterKnife?
🚫 4
c
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
thanks
g
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
"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
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
@gildor what will you recommend?
g
Depends on what you need. Probably ViewBindings, but they are on early stage of development and you need beta version of AGP
t
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
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
Make sure you're on 10.2.0
👍 1
Or, migrate to view binding 😁
👍 1
p
Or wait for Jetpack Compose 😁😁
t
thanks for the help
very much appreciated
the 10.2.0 worked