java.lang.IllegalStateException: Software rendering doesn't support hardware bitmaps
at android.graphics.BaseCanvas.throwIfHwBitmapInSwMode(BaseCanvas.java:562)
at android.graphics.BaseCanvas.throwIfCannotDraw(BaseCanvas.java:62)
at android.graphics.BaseCanvas.drawBitmap(BaseCanvas.java:120)
at android.graphics.Canvas.drawBitmap(Canvas.java:1441)
at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:529)
at android.widget.ImageView.onDraw(ImageView.java:1367)
at android.view.View.draw(View.java:20370)
at android.view.View.draw(View.java:20235)
at android.view.ViewGroup.drawChild(ViewGroup.java:4421)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207)
at android.view.View.draw(View.java:20373)
at android.view.View.draw(View.java:20235)
at android.view.ViewGroup.drawChild(ViewGroup.java:4421)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207)
at android.view.View.draw(View.java:20233)
at android.view.ViewGroup.drawChild(ViewGroup.java:4421)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4207)
at android.view.View.draw(View.java:20373)
at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:3586)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:3490)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3246)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2781)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1743)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7780)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:658)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
查了一下,貌似是Glide的问题。在Glide 4.x上,hardware bitmaps(开启hardware bitmaps作用大概就是在使用ARGB_8888这种高质量的图片时,图片在内存中只会存在一份,反正就是一种节省内存的机制。) 配置默认是开启的,这也是Glide的一个Bug,高版本不知道修复了没有。
解决方案是在构建RequestOptions时,将该配置关掉。
解决办法:requestOptions.disallowHardwareConfig();