18
votes

I have just started moving from Universal Image Loader to Glide. However, when scrolling down and up again in recyclerview I get tons of warning messages.

W/Bitmap: Called reconfigure on a bitmap that is in use! This may cause graphical corruption!

If i swap out Glide for another image loading library, the warning goes away. Code in bindViewHolder related to images:

   Glide.with(viewHolder.imageView.getContext())
            .load(DisplayImageUtil.getImageUrl(item.getImageUrl(), 600))
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .into(viewHolder.imageView);

Tested on a Nexus 5.

5
Is this happening on Android M? github.com/bumptech/glide/issues/743 - TWiStErRob
@Bendik . The problem occurs when I scroll up, and the image is loaded again.Have you find any solution? - Kartik Shah

5 Answers

1
votes

I run to the same issue after first run of my app on Android M (Nexus 5x).

EDIT: after opening the issue on Glide Github - https://github.com/bumptech/glide/issues/743, I found that my orignal "solution" did not solve the problem, only hide the messages. The warning comes from Android Bitmap and it is because Glide reuses the Bitmap for better performance.

0
votes

Try calling Glide.clear() before load the image.

Glide.clear(viewHolder.imageView);
Glide.with(viewHolder.imageView.getContext())
        .load(DisplayImageUtil.getImageUrl(item.getImageUrl(), 600))
        .diskCacheStrategy(DiskCacheStrategy.ALL)
        .into(viewHolder.imageView);

Hope this help.

0
votes

I was getting the warning and graphical corruption. This was in the form of clipped bitmaps appearing at the top and bottom of the recycler view and staying there if scrolling too quickly.

Putting the image view inside the frame layout has gotten rid of the graphical corruption.

0
votes

You can clean the logs with Logcat Filters on Android Studio.

Add ^(?!AbsListView|IInputConnectionWrapper|ApplicationPackageManager|Bitmap|ViewRootImpl) in Regex of Android Logcat filter.

0
votes

This is discussed here ,

Usually this is the result of misusing Bitmaps, either by returning a Bitmap to the pool multiple times without an intermediate get, or by referencing the Bitmap after calling clear() on the corresponding Target. If you have custom transformations, that's a good place to look closely to make sure you aren't returning a Bitmap to the pool twice. You can see more about this issue on the wiki: https://github.com/bumptech/glide/wiki/Resource-re-use-in-Glide.

The log you see is from catch block (caught exception). Make sure you are :

  • Not trying to load 2 bitmap in one target view
  • Not clearing the resource to reuse the target view but holding on to resource's reference

since you are using recyclerView, probably second point is true i.e. recycling the view while holding on to all bitmap references