Android: Kotlin with Butterknife

前端 未结 10 994
鱼传尺愫
鱼传尺愫 2020-12-24 04:55

I\'m trying to use Kotlin with Butterknife for my Android Application.

Here is my build.gradle

dependencies {
    ...
    compile \'com.jakewharton:b         


        
10条回答
  •  独厮守ぢ
    2020-12-24 05:47

    In your gradle:

    compile 'com.jakewharton:butterknife:8.8.0'
    kapt "com.jakewharton:butterknife-compiler:8.8.0"
    

    In your activity

    @BindView(R.id.toolbar)
    lateinit var mToolbar: Toolbar
    

    Of course, remember ButterKnife.bind(this) and apply the plugin on the top of your app.gradle apply plugin: 'kotlin-kapt'

    Check full example

    Full Link: https://github.com/JetBrains/kotlin-examples/tree/master/gradle/android-butterknife

提交回复
热议问题