Unresolved reference: GlideApp【K

2019-05-09  本文已影响0人  and2long

最近在项目中,遇到问题:GlideApp死活无法解析出来,查看Glide项目文档,很明显写着这样引入使用:

dependencies {
  implementation 'com.github.bumptech.glide:glide:4.9.0'
  annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
}

然后检查自己的代码,一模一样。多次点击🔨图标Make Project,始终提示Unresolved reference: GlideApp

反复搜索,终于在stackoverflow和Glide项目的issues中找到答案。

简单说明一下:

因为自己使用的Kotlin语言,所以在app的build.grandle中引入Glide时,需要用 kapt代替annotationprocessor
像下面这样:

dependencies {
  implementation 'com.github.bumptech.glide:glide:4.9.0'
  kapt 'com.github.bumptech.glide:compiler:4.9.0'
}

再点击🔨图标运行,就OK啦。

上一篇 下一篇

猜你喜欢

热点阅读