当我使用 glide with Bitmap 或 Bitmap drawable 时,应用程序在添加第 4 个连续图像时不断崩溃

Apps keeps on crashing while adding 4th consecutive image when i use glide with Bitmap or Bitmap drawable

我想知道如何在 Kotlin 中实现 Glide 以及使用位图压缩,并认为下面的任何代码都可以工作。但不幸的是,一旦我第四次将图像添加到任何 imageView 中,应用程序就会关闭。 这是我尝试实现的代码

val selectedImage = data?.data
val bitmap = MediaStore.Images.Media.getBitmap(contentResolver, selectedImage) 
//method 1
Glide.with(this).asBitmap().load(compressBitmap(bitmap,5)).into(imageView!!)
//method 2
var bitmapDrawable = BitmapDrawable( resources , compressBitmap(bitmap,5))
Glide.with(this).load(bitmapDrawable).into(imageView!!)

如果我这里有什么地方不对,正确的代码是什么。提前谢谢你

尝试使用 Recycler View 或其他组件加载图像。它们将处理加载。