'Android Kotlin - Glide error IllegalArgumentException glide.manager.RequestManagerRetriever.assertNotDestroyed
I see in the google play console that a few app users are getting this error:
java.lang.IllegalArgumentException:
at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed (RequestManagerRetriever.java:348)
at com.bumptech.glide.manager.RequestManagerRetriever.get (RequestManagerRetriever.java:148)
at com.bumptech.glide.Glide.with (Glide.java:826)
at de.xxx.bla.MainActivity.setHeader (MainActivity.kt:617)
at de.xxx.bla.MainActivity.requestAppConfig$lambda-8 (MainActivity.kt:481)
at de.xxx.bla.MainActivity$$InternalSyntheticLambda$1$ed844943413167d84155071c08c71caa93816230bdd81f0b165e27bb97857509$0.onResponse (MainActivity.java)
at com.android.volley.toolbox.StringRequest.deliverResponse (StringRequest.java:82)
at com.android.volley.toolbox.StringRequest.deliverResponse (StringRequest.java:29)
at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run (ExecutorDelivery.java:102)
at android.os.Handler.handleCallback (Handler.java:938)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loop (Looper.java:246)
at android.app.ActivityThread.main (ActivityThread.java:8633)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)
This is the set header function:
private fun setHeader(){
val userID = prefs.getLong("userid", 0)
if(userID != 0.toLong()){
val serverScaling = func.openServerScalingList()
val whichInt = func.getThirdInt(userID.toString())
val mediaServer = serverScaling[whichInt]
val glideProfileImageOptions = RequestOptions
.circleCropTransform()
.diskCacheStrategy(DiskCacheStrategy.DATA)
.skipMemoryCache(true)
Glide
.with(this@MainActivity)
.load("$mediaServer/media/profimg/?n=$userID.jpg")
.apply(glideProfileImageOptions)
.placeholder(R.drawable.ic_user)
.into(binding.contentMain.btnProfileImage)
}else{
Glide
.with(this@MainActivity)
.load(R.drawable.ic_user)
.into(binding.contentMain.btnProfileImage)
}
}
Before setting the header, sometimes glide clear cache is performed:
GlobalScope.launch(Dispatchers.Default) {
Glide.get(this@MainActivity).clearDiskCache()
}
it works fine on all my test devices, but can that be the cause why some users are getting crashes?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|