LoginSignup
3
3

More than 5 years have passed since last update.

[Android] KotlinとButterknifeのAnnotation Crash問題。

Posted at

問題

apply plugin: 'kotlin-kapt'

これはKotlinのannotationを使えることができる。
でも、
Butterknifeの@BindView@RealmClassのAnnotationの
Crash問題があった。

解決方法

Build.gradleを変えます。

Step one

順番大事です。

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'

Step Two

基本 annotationProcessor -→ kaptに変えます。

implementation 'com.jakewharton:butterknife:8.8.1'
kapt 'com.jakewharton:butterknife-compiler:8.8.1'

Step Three

すぐ下に。

kapt {
    generateStubs = true
}
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3