三星Galaxy S6 / 7/8 - RuntimeException / throwIfCannotDraw

时间:2022-07-16 18:54:41

recently as android 7.0.0 poped up and devices came with it my app started throwing exception with no particular reason. The problem is I have no idea what might be the problem - what I know is that it only occur on Samsung devices with Nougat and its about drawing some ImageViews. Can libs like Admob or Universal-Image-Loader do this or ?

最近随着android 7.0.0加速,设备随之而来,我的应用程序开始抛出异常,没有特别的原因。问题是我不知道可能是什么问题 - 我所知道的是,它只发生在三星设备上的Nougat及其绘制一些ImageViews。像Admob或Universal-Image-Loader这样的库可以这样做吗?

anyway here's the full exception - hope some1 can help me out ...

无论如何这里是完整的例外 - 希望some1可以帮助我...

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.widget.ImageView.onDraw(ImageView.java:1286)
  at android.view.View.draw(View.java:18313)
  at android.view.View.updateDisplayListIfDirty(View.java:17291)
  at android.view.View.draw(View.java:18075)
  at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
  at android.view.View.updateDisplayListIfDirty(View.java:17286)
  at android.view.View.draw(View.java:18075)
  at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
  at android.view.View.draw(View.java:18316)
  at android.view.View.updateDisplayListIfDirty(View.java:17291)
  at android.view.View.draw(View.java:18075)
  at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
  at android.view.View.updateDisplayListIfDirty(View.java:17286)
  at android.view.View.draw(View.java:18075)
  at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
  at android.view.View.updateDisplayListIfDirty(View.java:17286)
  at android.view.View.draw(View.java:18075)
  at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
  at android.view.View.draw(View.java:18316)
  at com.android.internal.policy.DecorView.draw(DecorView.java:850)
  at android.view.View.updateDisplayListIfDirty(View.java:17291)
  at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:666)
  at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:672)
  at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:780)
  at android.view.ViewRootImpl.draw(ViewRootImpl.java:3103)
  at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2899)
  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2493)
  at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1493)
  at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7040)
  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:6688)
  at java.lang.reflect.Method.invoke(Native Method:0)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)

2 个解决方案

#1


0  

Can you please check whether the bitmap is recycled before its get drawn?

你可以检查位图在被绘制之前是否被回收了吗?

#2


0  

I got this error when using a large bitmap as background of a TextView. Simply reducing the size of the bitmap in the main Drawable folder solved this issue for me. I guess that it could be even more elegantly solved by placing bitmaps of different resolutions in multiple Drawable folders

使用大位图作为TextView的背景时出现此错误。简单地减少Drawable主文件夹中位图的大小就解决了这个问题。我想通过在多个Drawable文件夹中放置不同分辨率的位图,可以更加优雅地解决这个问题

#1


0  

Can you please check whether the bitmap is recycled before its get drawn?

你可以检查位图在被绘制之前是否被回收了吗?

#2


0  

I got this error when using a large bitmap as background of a TextView. Simply reducing the size of the bitmap in the main Drawable folder solved this issue for me. I guess that it could be even more elegantly solved by placing bitmaps of different resolutions in multiple Drawable folders

使用大位图作为TextView的背景时出现此错误。简单地减少Drawable主文件夹中位图的大小就解决了这个问题。我想通过在多个Drawable文件夹中放置不同分辨率的位图,可以更加优雅地解决这个问题