首页 > 解决方案 > 错误:找不到符号类 GlideBitmapDrawable

问题描述

嗨,我收到错误消息:当我尝试在 android studio 中编译项目时,找不到符号类 GlideBitmapDrawable。如何解决错误。

我在 module:app 中添加了这三个依赖项

 implementation 'com.github.bumptech.glide:glide:4.9.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
    implementation "com.github.bumptech.glide:okhttp3-integration:4.0.0-RC1"

我在 GlideBitmapDrawable 的导入语句和代码中到达这里

import com.bumptech.glide.load.resource.bitmap.GlideBitmapDrawable;
 try {
            GlideBitmapDrawable drawable = (GlideBitmapDrawable) photoView.getDrawable();
            bitmap = drawable.getBitmap();
        } 

有人可以建议其中缺少什么吗?

标签: androidandroid-glide

解决方案


你需要使用

BitmapDrawable.

代替

GlideBitmapDrawable

来自 glide 的文档

GlideDrawable在 Glide v3 中已删除以支持标准 Android DrawableGlideBitmapDrawable已被删除以支持BitmapDrawable

欲了解更多信息,请阅读阅读Glide Drawables


推荐阅读