kotlin plugin kotlin-kapt 注解处理

在使用Google推出的Jetpack 库 CameraX时,

app 的build.gradle有如下内容 (部分截取)

apply plugin: 'com.android.application'
//kotlin-kapt插件Android的注解处理 java使用annotationProcessor 添加的依赖改为使用kapt
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //Kotlin lang
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    // App compat and UI things
    implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
    implementation 'androidx.core:core-ktx:1.0.2'
  
    //CameraX
    //core library.
    def camerax_version = "1.0.0-alpha03"
    implementation "androidx.camera:camera-core:${camerax_version}"
    // If you want to use Camera2 extensions. like Portrait, HDR, Night, and Beauty
    implementation "androidx.camera:camera-camera2:${camerax_version}"

    // Glide
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    kapt 'com.github.bumptech.glide:compiler:4.9.0'
}

    //图片缓存
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'

在kotlin中可以使用kapt插件来支持Android的注解处理

它把java使用annotationProcessor 添加的依赖改为使用kapt

参考:

kotlin注解处理

https://majing.io/posts/10000004681173

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值