Android Kotlin - 在后台线程中清除滑动缓存不起作用

Android Kotlin - clear glide cache in background thread doesn't work

GlobalScope.launch(Dispatchers.Default) {
    Glide.with(this@UploadProfileImage).clearDiskCache()
}

我在 clearDiskCache

得到 unresolved reference

当我做的时候

Glide.with(this).clearDiskCache()

相反,我没有在 clearDiskCache 上得到未解决的参考,但是

None of the following functions can be called with the arguments supplied: 
public open fun with(activity: Activity): RequestManager defined in com.bumptech.glide.Glide
public open fun with(fragment: android.app.Fragment): RequestManager defined in com.bumptech.glide.Glide
public open fun with(context: Context): RequestManager defined in com.bumptech.glide.Glide
public open fun with(view: View): RequestManager defined in com.bumptech.glide.Glide
public open fun with(fragment: androidx.fragment.app.Fragment): RequestManager defined in com.bumptech.glide.Glide
public open fun with(activity: FragmentActivity): RequestManager defined in com.bumptech.glide.Glide

with

你应该使用 'Glide.get(context)' 而不是 'Glide.with(context)' 来使用 'clearDiskCache' 方法。