Crash: Application crashes on uploading a large image
See original GitHub issueSummary:
The application crashes on uploading a very large image. In this case, the image size was 28.69MB.
Steps to reproduce:
- Find an image which has a large size.
- 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:
- Created 4 years ago
- Comments:15 (12 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
@Pratham2305 Yes, you’re right, but there are other consequences of using
android:hardwareAccelerated="false"
. So, I think it is not the best solution.