GlideApp无法生成的问题
2019-03-27 本文已影响0人
zhujunhua
在Glide4.x之后,流式api使用的GlideApp可能发生无法编译生成的问题。
# 这个如果在 lib-module 中,使用 api 'xxx'
implementation 'com.github.bumptech.glide:glide:4.9.0'
#这个annotationProcessor,需要放在 app-module 中
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
kotlin代码使用如下配置(kapt
需要在app-module
的build下):
apply plugin: "kotlin-android"
apply plugin: "kotlin-android-extensions"
apply plugin: "kotlin-kapt"
...
android {
}
dependencies {
implementation "com.github.bumptech.glide:glide:4.9.0"
// annotationProcessor "com.github.bumptech.glide:compiler:4.9.0"
kapt "com.github.bumptech.glide:compiler:4.9.0"
}
...
apply plugin: "com.google.gms.google-services"
另外,
// 这个AppGlideModule需要放在 app-module 中的应用名的包下(比如application id: com.example.glide)
package com.example.glide
@GlideModule
public class MyAppGlideModule extends AppGlideModule {
}
如此,再编译Build->Rebuild Project
之后即可使用GlideApp。