question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash: Application crashes on uploading a large image

See original GitHub issue

Summary:

The application crashes on uploading a very large image. In this case, the image size was 28.69MB.

Steps to reproduce:

  1. Find an image which has a large size.
  2. Try uploading it.

System logs:

java.lang.RuntimeException: Canvas: trying to draw too large(192000000bytes) bitmap.
        2020-02-02 05:35:10.603 30429-30429/fr.free.nrw.commons.beta E/AndroidRuntime: FATAL EXCEPTION: main
    Process: fr.free.nrw.commons.beta, PID: 30429
    java.lang.RuntimeException: Canvas: trying to draw too large(192000000bytes) bitmap.
        at android.view.DisplayListCanvas.throwIfCannotDraw(DisplayListCanvas.java:229)
        at android.view.RecordingCanvas.drawBitmap(RecordingCanvas.java:98)
        at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:545)
        at android.widget.ImageView.onDraw(ImageView.java:1360)
        at android.view.View.draw(View.java:20238)
        at android.view.View.updateDisplayListIfDirty(View.java:19113)
        at android.view.View.draw(View.java:19966)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4114)
        at android.view.View.updateDisplayListIfDirty(View.java:19104)
        at android.view.View.draw(View.java:19966)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4114)
        at android.view.View.draw(View.java:20241)
        at androidx.viewpager.widget.ViewPager.draw(ViewPager.java:2426)
        at android.view.View.updateDisplayListIfDirty(View.java:19113)
        at android.view.View.draw(View.java:19966)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4114)
        at android.view.View.updateDisplayListIfDirty(View.java:19104)
        at android.view.View.draw(View.java:19966)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4114)
        at android.view.View.updateDisplayListIfDirty(View.java:19104)
        at android.view.View.draw(View.java:19966)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4114)
        at android.view.View.updateDisplayListIfDirty(View.java:19104)
        at android.view.View.draw(View.java:19966)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4114)
        at android.view.View.updateDisplayListIfDirty(View.java:19104)
        at android.view.View.draw(View.java:19966)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4114)
        at android.view.View.updateDisplayListIfDirty(View.java:19104)
        at android.view.View.draw(View.java:19966)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4114)
        at android.view.View.draw(View.java:20241)
        at com.android.internal.policy.DecorView.draw(DecorView.java:784)
        at android.view.View.updateDisplayListIfDirty(View.java:19113)
        at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:686)
        at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:692)
        at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:801)
        at android.view.ViewRootImpl.draw(ViewRootImpl.java:3403)
        at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3193)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2562)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1532)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7406)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1092)
        at android.view.Choreographer.doCallbacks(Choreographer.java:888)
        at android.view.Choreographer.doFrame(Choreographer.java:819)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1078)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:201)
        at android.app.ActivityThread.main(ActivityThread.java:6823)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)


Device and Android version:

What make and model device: Redmi Note 7 Pro What Android version: Android 9

Commons app version: version: 2.12.2-debug branch: master

Would you like to work on the issue?

Yes. I would like to work on this issue.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:15 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
misaochancommented, Feb 4, 2020

Going to tag @nicolas-raoul for this one, as I am not sure what the Commons community’s stance is on extremely large uploads - it will affect whether we choose to compress before or after.

1reaction
mrudultoracommented, Feb 22, 2021

@Pratham2305 Yes, you’re right, but there are other consequences of using android:hardwareAccelerated="false". So, I think it is not the best solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

App crashes when an uploaded large image is sent to the next ...
The code works perfectly when uploading and displaying the large image but crashes when sending it to the next activity. I have tried...
Read more >
Uploaders "crashing" while uploading large numbers Images
I have tried both uploaders, both seem to crash after a while. The one accessible from the post, manages to upload 17-18 images...
Read more >
[Win10] Desktop App crashing when uploading image
Every time I try to upload an image to my playlist cover image, the whole app crashes. No crash notice, no "Not Responding",...
Read more >
Send a lot of images to a webapi and the app crashes - MSDN
Probably out of memory exception (app or server). And also sending 3000 pictures is a lot of web api load (and bandwidth). You...
Read more >
(Docker) Ghost silently crashes when uploading images
If you haven't made changes, that's just fine. The big issue appears to be that your logs aren't persisting after a crash, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found