-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java.Lang.RuntimeException Message=Canvas: trying to use a recycled bitmap android.graphics.Bitmap@5d9bccf #13534
Comments
We believe that #9011 was resolved in a PR that was released in 7.0.59. Can you please confirm that you're using that version? Thanks! |
Hi @RodBarnes. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
Opened terminal and did
|
Hi @RodBarnes. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
Targeting .NET 7 it does not exhibit the issue. What is the chance of getting this backported to .NET 6? That is the LTS and it isn't possible to target Android 12/API 31 without targeting .NET 6 -- they're joined at the hip. There are a lot of Android 12 devices still out there in use as they are only a couple years old. |
@RodBarnes Please take a look at this article about Android API versions--this document mentions Xamarin, but this is actually an Android convention that applies to .NET MAUI, too. It can certainly be confusing! The TLDR; is that you can (and should) compile with the latest version of Android, but that does not limit the minimum API that your app can run on. If you target API 31 or 32+, your .NET MAUI app will still be able to run on devices as early as API 21. In other words, you do not have to target .NET 6 to ensure that your apps run on Android 12 devices. .NET MAUI uses the modern lifecycle, so we always recommend updating to the latest stable version as soon as possible. Please let us know if you encounter any other blockers to updating to .NET 7, and we'll consider backporting this to .NET 6 at that time. Thanks!! |
Hi @RodBarnes. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version. You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
Understood. I will make another attempt and report back. |
Yes, that works. It's been a few years since I'd built an Android app (early days of Xamarin) and forgotten about the target/minimum thing on the API. Setting the target to .NET 7/API 33 with minimum API 29 built and ran fine. And now the original issue is gone. Thanks for the kind reminder and for the fix as well. |
Wonderful!! Thank you so much for getting back to us. Happy coding!!! |
Description
NOTE: Searched for matching issues and found issue #9007. But it was closed in favor of #9011 which was closed without any apparent resolution? I tried the workaround found there #9011 (comment) but couldn't get it to build.
This only happens when deployed to an device (Android 12). It doesn't happen on the emulator (API 31). The project is targeting .NET 6 since .NET 7 does not support API 31.
Visually, the error occurs when scrolling through a CollectionView of images.
I did find a workaround but it is subtle and only discovered by digging around. The image reuse should work without this workaround and forcing the developer to "guess" what to do to fix it.
Steps to Reproduce
Same error can be manifested on all image lists that have seven(?) or more images; i.e., enough images that the list has to be reused.
Link to public reproduction project repository
https://github.com/RodBarnes/NationalParks
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
API 31, Android 12
Did you find any workaround?
I found that by adding a
HeightRequest
attribute to the image I could keep this from happening. Which is great, but there is nothing that would tell me that is the correct thing to do without digging around. In the output (included below), I saw a statement for each image that was viewed that spoke about the image size being a consideration. So that led me to consider adding aHeightRequest
orWidthRequest
. But theWidthRequest
did not work. Subsequently, I see the #9011 (comment) where someone else stumbled upon this.Relevant log output
The text was updated successfully, but these errors were encountered: