DraweeView draws recycled bitmap
java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@16502a96
at android.graphics.Canvas.throwIfCannotDraw(Canvas.java:1282)
at android.view.GLES20Canvas.drawBitmap(GLES20Canvas.java:599)
at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:538)
at com.facebook.drawee.drawable.ForwardingDrawable.draw(ForwardingDrawable.java:140)
at com.facebook.drawee.drawable.ScaleTypeDrawable.draw(ScaleTypeDrawable.java:104)
at com.facebook.drawee.drawable.FadeDrawable.drawDrawableWithAlpha(FadeDrawable.java:306)
at com.facebook.drawee.drawable.FadeDrawable.draw(FadeDrawable.java:293)
at com.facebook.drawee.drawable.ForwardingDrawable.draw(ForwardingDrawable.java:140)
at com.facebook.drawee.generic.GenericDraweeHierarchy$RootDrawable.draw(GenericDraweeHierarchy.java:133)
at android.widget.ImageView.onDraw(ImageView.java:1158)
at android.view.View.draw(View.java:15231)
at android.view.View.updateDisplayListIfDirty(View.java:14167)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
at android.view.View.updateDisplayListIfDirty(View.java:14127)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
at android.view.View.updateDisplayListIfDirty(View.java:14127)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
at android.view.View.updateDisplayListIfDirty(View.java:14127)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
at android.view.View.updateDisplayListIfDirty(View.java:14127)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
at android.view.View.updateDisplayListIfDirty(View.java:14127)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
at android.view.View.updateDisplayListIfDirty(View.java:14127)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
at android.view.View.updateDisplayListIfDirty(View.java:14127)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
at android.view.View.updateDisplayListIfDirty(View.java:14127)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
at android.view.View.updateDisplayListIfDirty(View.java:14127)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
at android.view.View.updateDisplayListIfDirty(View.java:14127)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
at android.view.View.updateDisplayListIfDirty(View.java:14127)
at android.view.View.getDisplayList(View.java:14189)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java
Why this exception occur ? Can any one explain me
java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@16502a9 mean you bitmap was recycled before drawing.
What details you want i am just load simply image to simpledraweeView thats it..
Can you show your code?
From the title, I assume the author just uses SimpleDraweeView. This looks like a Fresco bug. Probably something in the pipeline as there have not been any recent changes on the Drawee part that I am aware of. It seems that we are closing bitmap while it is still being used by the view.
Same issue happens to me when using RecyclerView.
if (tooLarge) {
draweeView.setImageURI(Resource Uri);
) else {
ImageRequest ...
DraweeController ...
draweeView.setController(controller);
)
Is this still happening for newer Fresco versions (v0.13)?
It still happening in Fresco versions (v0.11). Have any better solution to handle it?
@tcf150 I recommend that inherit SimpleDraweeView and use try/catch statement.
@Override
public void setImageDrawable(Drawable drawable) {
try {
super.setImageDrawable(drawable);
catch {
Log.e(....
}
}
I'm closing this issue since we don't have a repro for this and we've released many new versions since then. Let us know if this is still an issue.
I did receive this in Android Vitals reported twice today. It has occurred on Android 9 with Fresco version 1.13.0. It'd be great if you investigated this.
I got this crash too when I try to load gif in viewpager with draweeview. And the version is 1.13.0. How can I fix it?