在使用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
参考:
CameraX与Glide在Android应用中的集成
本文介绍在Android应用中如何使用Google的Jetpack库CameraX进行相机功能开发,并通过Glide库实现图片缓存。文章展示了在build.gradle文件中添加相应依赖的方法,包括CameraX的核心库及Camera2扩展,以及Glide的集成。
1万+

被折叠的 条评论
为什么被折叠?



