Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

My application work very well on nougat emulator and many devices, but i found this exception in google play crash reporter, I don't know why it happened, The exception causes with nougat devices ++ only.

the exception :

   java.lang.RuntimeException: 
  at android.view.DisplayListCanvas.throwIfCannotDraw(DisplayListCanvas.java:260)
  at android.graphics.Canvas.drawBitmap(Canvas.java:1420)
  at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:545)
  at android.view.View.getDrawableRenderNode(View.java:18591)
  at android.view.View.drawBackground(View.java:18527)
  at android.view.View.draw(View.java:18315)
  at android.view.View.updateDisplayListIfDirty(View.java:17302)
  at android.view.View.draw(View.java:18086)
  at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
  at android.view.View.updateDisplayListIfDirty(View.java:17297)
  at android.view.View.draw(View.java:18086)
  at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
  at android.view.View.updateDisplayListIfDirty(View.java:17297)
  at android.view.View.draw(View.java:18086)
  at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
  at android.view.View.updateDisplayListIfDirty(View.java:17297)
  at android.view.View.draw(View.java:18086)
  at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
  at android.view.View.updateDisplayListIfDirty(View.java:17297)
  at android.view.View.draw(View.java:18086)
  at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
  at android.view.View.draw(View.java:18327)
  at com.android.internal.policy.DecorView.draw(DecorView.java:919)
  at android.view.View.updateDisplayListIfDirty(View.java:17302)
  at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:692)
  at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:698)
  at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:806)
  at android.view.ViewRootImpl.draw(ViewRootImpl.java:3135)
  at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2931)
  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2523)
  at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1522)
  at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7098)
  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:927)
  at android.view.Choreographer.doCallbacks(Choreographer.java:702)
  at android.view.Choreographer.doFrame(Choreographer.java:638)
  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:913)
  at android.os.Handler.handleCallback(Handler.java:751)
  at android.os.Handler.dispatchMessage(Handler.java:95)
  at android.os.Looper.loop(Looper.java:154)
  at android.app.ActivityThread.main(ActivityThread.java:6682)
  at java.lang.reflect.Method.invoke(Native Method:0)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

What this error could be?

CAUTION: all drawable i used is less than 1MB.

I have the exact same problem with samsung galaxy s6 s7 and s8. If u find a solution please share it with us – Ramdane Oualitsen Mar 1, 2018 at 10:05 i had the same issue try this link and you may save so much time in searching for solution stackoverflow.com/questions/39111248/… – Divyanshu Kumar Mar 16, 2020 at 14:47

I had the exact same problem with Samsung Galaxy S6 S7 S8. In my case Splash Screen had high resolution and it was mistakenly placed in the drawable folder. I found solution from this answer.

  • Right Click on drawable -> New -> Directory.
  • Enter new directory name: xxhdpi. It will create a new folder named drawable-xxhdpi if you go to res
  • Move your splash image from drawable to drawable-xxhdpi.
  • I am getting the same issue on Samsung S7 and J7 and I have tried this solution. But still getting the same error. – Aashish Kumar Jul 27, 2020 at 12:22 This logic solved the issue in my case for Samsung S6 with Sdks 21, 22, 23 and 24, 1440x2560 and 640 dpi (xxxhdpi). I created a drawable-xxxhdpi and put the splash image there. – Luciano Brum Dec 23, 2020 at 14:37

    Just Resize your image in my case my Splash screen image dimensions are 1544x2100 so i changed to 1080x2100 and that will work!! Hope this will help!!! Thanks!!!

    Your splash imgae should not be large you have to either resize or move it to xxxhdpi folder. – Divyaraj Dec 23, 2020 at 15:10 Is your images in drawable folder? Try to move on drawable_hdpi folder. It can help. Check this link: stackoverflow.com/questions/39111248/… – mzherdev Jul 5, 2017 at 8:28 @Override protected void throwIfCannotDraw(Bitmap bitmap) { super.throwIfCannotDraw(bitmap); int bitmapSize = bitmap.getByteCount(); if (bitmapSize > MAX_BITMAP_SIZE) { throw new RuntimeException( "Canvas: trying to draw too large(" + bitmapSize + "bytes) bitmap.");

    See this code in DisplayListCanvas,otherwise look at View#draw() method,

    boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) {
        boolean drawingWithRenderNode = mAttachInfo != null
                    && mAttachInfo.mHardwareAccelerated
                    && hardwareAcceleratedCanvas;
        if (drawingWithRenderNode) {
            // Delay getting the display list until animation-driven alpha values are
            // set up and possibly passed on to the view
            renderNode = updateDisplayListIfDirty();
            if (!renderNode.isValid()) {
                // Uncommon, but possible. If a view is removed from the hierarchy during the call
                // to getDisplayList(), the display list will be marked invalid and we should not
                // try to use it again.
                renderNode = null;
                drawingWithRenderNode = false;
    

    that why we can resolve the problem by cancel the hardwareAccelerated

    Disabling hardwareAccelerated could cause other problems and performance issues that can affect user experience and interface. – Luciano Brum Dec 23, 2020 at 14:15

    To anyone who still needs an answer to this question(as I did two days ago) the answer is simple: Resize all your images that are above 1024 x 1024 to 1024 x 1024, for example I had an image with something like 1080 x 850, that 1080 is a problem and would thus need to be resized and scaled down to 1024 and if you use a photo editing tool, when scaling it will automatically set the correct width / length to your image

    Just an addition to the Shuvo Joseph's answer, maybe it's a good idea to not only add drawable-xxhdpi density folder, but also add another density folder.
    So whatever the android version and size, your app can prepare the image source with the right size :

  • Change your folder view on the top left from Android to Project
  • Go to YourProjectFolder folder > app > src > main > res
  • Prepare the original image with your best resolution, and split it into each folder size automatically. You can do it in Baker
  • Then create a folder with another density, namely:
  • drawable-hdpi, drawable-ldpi, drawable-mdpi, drawable-xhdpi, drawable-xxhdpi, drawable-xxxhdpi
  • Put each image into the appropriate folder
  • Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.