Skip to content
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

Too large image crashes app #34

Open
lifeweaver opened this issue Jan 17, 2022 · 3 comments
Open

Too large image crashes app #34

lifeweaver opened this issue Jan 17, 2022 · 3 comments

Comments

@lifeweaver
Copy link

I'm not sure what image it was, but it was the Columbus subreddit. Happens anytime I try to open the

app.

FATAL EXCEPTION: main
Process: au.com.wallaceit.reddinator, PID: 29992
java.lang.RuntimeException: Canvas: trying to draw too large(634636864bytes) bitmap.
at android.graphics.RecordingCanvas.throwIfCannotDraw(RecordingCanvas.java:266)
at android.graphics.BaseRecordingCanvas.drawBitmap(BaseRecordingCanvas.java:94)
at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:549)
at android.widget.ImageView.onDraw(ImageView.java:1442)
at android.view.View.draw(View.java:22644)
at android.view.View.updateDisplayListIfDirty(View.java:21519)
at android.view.View.draw(View.java:22375)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at android.view.View.updateDisplayListIfDirty(View.java:21510)
at android.view.View.draw(View.java:22375)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at android.view.View.updateDisplayListIfDirty(View.java:21510)
at android.view.View.draw(View.java:22375)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at android.widget.ListView.drawChild(ListView.java:3613)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at android.widget.AbsListView.dispatchDraw(AbsListView.java:2679)
at android.widget.ListView.dispatchDraw(ListView.java:3608)
at android.view.View.draw(View.java:22647)
at android.widget.AbsListView.draw(AbsListView.java:4443)
at android.view.View.updateDisplayListIfDirty(View.java:21519)
at android.view.View.draw(View.java:22375)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at android.view.View.draw(View.java:22647)
at android.view.View.updateDisplayListIfDirty(View.java:21519)
at android.view.View.draw(View.java:22375)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at android.view.View.updateDisplayListIfDirty(View.java:21510)
at android.view.View.draw(View.java:22375)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at android.view.View.draw(View.java:22647)
at com.android.internal.widget.ActionBarOverlayLayout.draw(ActionBarOverlayLayout.java:517)
at android.view.View.updateDisplayListIfDirty(View.java:21519)
at android.view.View.draw(View.java:22375)
at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
at android.view.View.draw(View.java:22647)
at com.android.internal.policy.DecorView.draw(DecorView.java:820)
at android.view.View.updateDisplayListIfDirty(View.java:21519)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:534)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:540)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:616)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:4421)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4149)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3309)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2126)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8653)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1037)
at android.view.Choreographer.doCallbacks(Choreographer.java:845)
at android.view.Choreographer.doFrame(Choreographer.java:780)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)

@lifeweaver
Copy link
Author

I'll see if I can do a pull request. This was on Android 12, Pixel 6 Pro.

@lifeweaver
Copy link
Author

@lifeweaver
Copy link
Author

I was able to get the image to load by following: https://developer.android.com/topic/performance/graphics/load-bitmap and setting the reqWidth to 2048, and the reqHeight to 1080. That made sure the image was small enough to load. I'm pretty sure it could be optimized to just get the view width/height and pass that.

lifeweaver added a commit to lifeweaver/reddinator that referenced this issue Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant