I'm learning kotlin recently, then I tried to use ButterKnife with Kotlin directly, of course, nothing happened. Then I searched it, asked for help, and read the Kotlin's refrences-Kapt again to get an answer: use kapt and ButterKnife will work.
So my suggestion is add:
If you are using Kotlin
apply plugin: 'kotlin-kapt'and this:
- annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0' + kapt 'com.jakewharton:butterknife-compiler:8.6.0'to ButterKnife-Download to tell others this works with Kotlin, maybe someone is looking for help just like me =)
Thanks so much! Have been trying to get it to work for ages now 😅
But if you are using Kotlin than you don't really need Butterknife anymore. You can use Android Kotlin Extensions. It is just a suggestion (of course).
Or property delegates
On Mon, Jun 12, 2017 at 11:04 PM Gabriel Oshiro notifications@github.com
wrote:
But if you are using Kotlin than you don't really need Butterknife
anymore. You can use Android Kotlin Extensions
https://kotlinlang.org/docs/tutorials/android-plugin.html. It is just a
suggestion (of course).—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/JakeWharton/butterknife/issues/966#issuecomment-307993241,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEEEV0u5ETaKizb0MImf5eUULzcU-SZks5sDfw9gaJpZM4NjqSj
.
I had some problems switching from annotionProcessor to kapt because annotionProcessor disables java incremental builds by default and kapt doesn't. I had to disable it for my own
compileOptions.incremental = false
I think it is only necessary if you have a Base Class with @BindView fields.
Most helpful comment
But if you are using Kotlin than you don't really need Butterknife anymore. You can use Android Kotlin Extensions. It is just a suggestion (of course).