error: cannot find symbol class GlideBitmapDrawable

error: cannot find symbol class GlideBitmapDrawable

您好,当我尝试在 android studio 中编译项目时,出现错误:找不到符号 class 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();
        } 

任何人都可以建议其中缺少什么吗?

GlideBitmapDrawable 来自 Glide 3,您现在使用的是 Glide 4,其架构发生了很大变化。看一下这个 https://bumptech.github.io/glide/doc/migrating.html

您需要使用

BitmapDrawable.

而不是

GlideBitmapDrawable

来自 glide 的文档

GlideDrawable in Glide v3 has been removed in favor of the standard Android Drawable. GlideBitmapDrawable has been removed in favor of BitmapDrawable.

更多信息请阅读阅读Glide Drawables