-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
App crashes when Cloudy is used in the Column with verticalScroll #7
Comments
yep, i have the same problem. Im with a lazycolumn and i see a strange effect when you start to scroll the images or a texts. Anyone know how to fix it? |
E/AndroidRuntime: FATAL EXCEPTION: main with just normal Column |
Seems to occur when you scroll at anything but a turtle's pace Can reproduce with a LazyColumn |
TL;DR this is caused by PixelCopy, can't copy scrollable content, because they are out of bounds of view containing Window. View.drawToBitmap might work, but will have to disable hardware acceleration for App, Activity or Glide Request(more about glide here Hello the root cause of your problem is hardware acceleration. Cloudy/cloudy/src/main/kotlin/com/skydoves/cloudy/Cloudy.kt Lines 229 to 247 in db2bd22
You can see contents of drawToBitmap here: Now let's see how drawBitmapWithPixelCopy works: Cloudy/cloudy/src/main/kotlin/com/skydoves/cloudy/Cloudy.kt Lines 258 to 287 in db2bd22
As you can see the exception: If we look inside the request function, we can see that the new surface object is created from source Window:
You can check window's width and height to see that it is close to the screen dimensions, it does not matter if you have scrolling content inside of that window. It is not actually PixelCopy class that does the actual copying of Pixels, the chain of method calls goes deep into the native code starting from copySurfaceInto is actually not a method of ThreadedRenderer it is from its parent HardwareRenderer as you can see: HardwareRenderer calls native method: Here as you can see inside of HardwareRenderer.cpp copySurfaceInto call is delegated to RenderProxy: RenderProxy gets an Instance of RenderThread, then gets a ReadBack field from RenderThread Instance and calls copySurfaceInto function: here is the method to get ReadBack: And here we have the actual implementation of copySurfaceInto function in ReadBack class: Because this is native code deep within AOSP, I have not fully grasped it nor do I have a way to debug it. However here is the list of all lines that return Unknown Error:
You can read what software bitmap functions no longer work, because of hardware bitmaps: |
The same problem is happening on my side. Here is the crash : |
Have the same problem |
the issue still persists |
-- API 29 - Android 10 (Pixel 5 Android Studio emulator)
-- API 33 - Android 13 (OnePlus 8 physical device)
Describe the Bug:
When we try to use Cloudy in any structure that uses vertical scroll in any of the parents, the app crashes.
Error -> java.lang.RuntimeException: Failed to copy pixels of the given bitmap!
Example of the code that crashes (this is tested on the blank project):
Expected Behavior:
This should work in the scrollable structure.
The text was updated successfully, but these errors were encountered: