Does butterknife 7.x work with Kotlin M14?

对着背影说爱祢 提交于 2019-12-05 01:31:50

It does work with the current version of Kotlin (1.0.0-beta-3595), I suggest you to take a look at the android-butterknife project which can be found inside the JetBrains's kotlin-examples repo. In short all you need to do is:

  1. Add the following to your app/build.gradle file:

    kapt {
        generateStubs = true
    }
    
  2. Put the following line inside the dependencies block of the same build.gradle file (assuming you already added compile 'com.jakewharton:butterknife:7.0.1' to your dependencies):

    kapt 'com.jakewharton:butterknife:7.0.1'
    

And that should be it.

Butterknife is supported. Use kapt: [1], [2].

Note that Butterknife does not support private Java fields, so you can use the lateinit modifier to make it public.

Also, if you use kapt, apply plugin: 'com.neenbedankt.android-apt' line is not needed anymore.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!