Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

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

I get unresolved reference on clearDiskCache

When I do

Glide.with(this).clearDiskCache()

instead then I don’t get unresolved reference on clearDiskCache but

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

on with

>Solution :

you should use ‘Glide.get(context)’ instead of ‘Glide.with(context)’ to use ‘clearDiskCache’ method.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading