错误:java.lang.RuntimeException:Canvas:尝试绘制太大的位图

时间:2018-06-10 00:07:58

标签: android android-bitmap

  

06-10 05:32:46.0​​32 3113-3113 /?我/ zygote:没有迟到-Xcheck:jni(已经开启)   06-10 05:32:46.0​​79 3113-3113 /? W / zygote:使用默认值的X86的意外CPU变体:x86   06-10 05:32:47.021 3113-3182 / com.ukccalculator.pksnh.ukccalculator D / OpenGLRenderer:HWUI GL Pipeline   06-10 05:32:47.185 3113-3182 / com.ukccalculator.pksnh.ukccalculator I / OpenGLRenderer:初始化的EGL,版本1.4   06-10 05:32:47.185 3113-3182 / com.ukccalculator.pksnh.ukccalculator D / OpenGLRenderer:交换行为1   06-10 05:32:47.185 3113-3182 / com.ukccalculator.pksnh.ukccalculator W / OpenGLRenderer:无法用EGL_SWAP_BEHAVIOR_PRESERVED选择配置,重试没有...   06-10 05:32:47.185 3113-3182 / com.ukccalculator.pksnh.ukccalculator D / OpenGLRenderer:交换行为0   06-10 05:32:47.203 3113-3182 / com.ukccalculator.pksnh.ukccalculator D / EGL_emulation:eglCreateContext:0xa1605300:maj 3 min 0 rcv 3   06-10 05:32:47.239 3113-3182 / com.ukccalculator.pksnh.ukccalculator D / EGL_emulation:eglMakeCurrent:0xa1605300:ver 3 0(tinfo 0xa16031d0)   06-10 05:32:47.251 3113-3182 / com.ukccalculator.pksnh.ukccalculator E / eglCodecCommon:glUtilsParamSize:unknow param 0x00008cdf       glUtilsParamSize:unknow param 0x00008cdf       glUtilsParamSize:unknow param 0x00008824   06-10 05:32:47.252 3113-3182 / com.ukccalculator.pksnh.ukccalculator E / eglCodecCommon:glUtilsParamSize:unknow param 0x00008824   06-10 05:32:47.318 3113-3182 / com.ukccalculator.pksnh.ukccalculator D / EGL_emulation:eglMakeCurrent:0xa1605300:ver 3 0(tinfo 0xa16031d0)   06-10 05:32:57.756 3113-3182 / com.ukccalculator.pksnh.ukccalculator D / EGL_emulation:eglMakeCurrent:0xa1605300:ver 3 0(tinfo 0xa16031d0)   06-10 05:32:57.869 3113-3182 / com.ukccalculator.pksnh.ukccalculator D / EGL_emulation:eglMakeCurrent:0xa1605300:ver 3 0(tinfo 0xa16031d0)   06-10 05:32:58.410 3113-3120 / com.ukccalculator.pksnh.ukccalculator I / zygote:部分代码缓存集合,代码= 13KB,数据= 24KB       代码缓存收集后,代码= 13KB,数据= 24KB   06-10 05:32:58.411 3113-3120 / com.ukccalculator.pksnh.ukccalculator I / zygote:将代码缓存容量增加到128KB       部分代码缓存集合,代码= 13KB,数据= 42KB       代码缓存收集后,代码= 13KB,数据= 42KB       将代码缓存容量增加到256KB   06-10 05:32:58.419 3113-3120 / com.ukccalculator.pksnh.ukccalculator I / zygote:JIT为void android.widget.TextView的编译代码分配了71KB。(android.content.Context,android.util.AttributeSet, int,int)   06-10 05:32:58.430 3113-3120 / com.ukccalculator.pksnh.ukccalculator I / zygote:编译器分配4MB来编译void android.widget.TextView。(android.content.Context,android.util.AttributeSet,int, INT)   06-10 05:32:58.452 3113-3182 / com.ukccalculator.pksnh.ukccalculator D / EGL_emulation:eglMakeCurrent:0xa1605300:ver 3 0(tinfo 0xa16031d0)   06-10 05:32:58.584 3113-3113 / com.ukccalculator.pksnh.ukccalculator I / Choreographer:跳过31帧!应用程序可能在其主线程上做了太多工作。   06-10 05:33:00.571 3113-3120 / com.ukccalculator.pksnh.ukccalculator I / zygote:完整代码缓存集合,代码= 105KB,数据= 68KB   06-10 05:33:00.573 3113-3120 / com.ukccalculator.pksnh.ukccalculator I / zygote:代码缓存收集后,代码= 104KB,数据= 55KB   06-10 05:33:00.923 3113-3113 / com.ukccalculator.pksnh.ukccalculator I / zygote:启动阻止GC NativeAlloc   06-10 05:33:00.962 3113-3182 / com.ukccalculator.pksnh.ukccalculator D / EGL_emulation:eglMakeCurrent:0xa1605300:ver 3 0(tinfo 0xa16031d0)   06-10 05:33:01.118 3113-3113 / com.ukccalculator.pksnh.ukccalculator D / AndroidRuntime:关闭VM
      ---------崩溃的开始   06-10 05:33:01.124 3113-3113 / com.ukccalculator.pksnh.ukccalculator E / AndroidRuntime:FATAL EXCEPTION:main       处理:com.ukccalculator.pksnh.ukccalculator,PID:3113       java.lang.RuntimeException:Canvas:尝试绘制太大(207098424bytes)的位图。           在android.view.DisplayListCanvas.throwIfCannotDraw(DisplayListCanvas.java:229)           在android.view.RecordingCanvas.drawBitmap(RecordingCanvas.java:97)           在android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:529)           在android.widget.ImageView.onDraw(ImageView.java:1367)           在android.view.View.draw(View.java:19123)           在android.view.View.updateDisplayListIfDirty(View.java:18073)           在android.view.View.draw(View.java:18851)           在android.view.ViewGroup.drawChild(ViewGroup.java:4214)           在android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)           在android.support.constraint.ConstraintLayout.dispatchDraw(ConstraintLayout.java:1963)           在android.view.View.updateDisplayListIfDirty(View.java:18064)           在android.view.View.draw(View.java:18851)           在android.view.ViewGroup.drawChild(ViewGroup.java:4214)           在android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)           在android.view.View.updateDisplayListIfDirty(View.java:18064)           在android.view.View.draw(View.java:18851)           在android.view.ViewGroup.drawChild(ViewGroup.java:4214)           在android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)           在android.view.View.updateDisplayListIfDirty(View.java:18064)           在android.view.View.draw(View.java:18851)           在android.view.ViewGroup.drawChild(ViewGroup.java:4214)           在android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)           在android.view.View.updateDisplayListIfDirty(View.java:18064)           在android.view.View.draw(View.java:18851)           在android.view.ViewGroup.drawChild(ViewGroup.java:4214)           在android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)           在android.view.View.updateDisplayListIfDirty(View.java:18064)           在android.view.View.draw(View.java:18851)           在android.view.ViewGroup.drawChild(ViewGroup.java:4214)           在android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)           在android.view.View.draw(View.java:19126)           在com.android.internal.policy.DecorView.draw(DecorView.java:785)           在android.view.View.updateDisplayListIfDirty(View.java:18073)           在android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:643)           在android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:649)           在android.view.ThreadedRenderer.draw(ThreadedRenderer.java:757)           在android.view.ViewRootImpl.draw(ViewRootImpl.java:2980)           在android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2794)           在android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2347)           在android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1386)           在android.view.ViewRootImpl $ TraversalRunnable.run(ViewRootImpl.java:6733)           在android.view.Choreographer $ CallbackRecord.run(Choreographer.java:911)           在android.view.Choreographer.doCallbacks(Choreographer.java:723)           在android.view.Choreographer.doFrame(Choreographer.java:658)           在android.view.Choreographer $ FrameDisplayEventReceiver.run(Choreographer.java:897)           在android.os.Handler.handleCallback(Handler.java:789)           在android.os.Handler.dispatchMessage(Handler.java:98)           在android.os.Looper.loop(Looper.java:164)           在android.app.ActivityThread.main(ActivityThread.java:6541)           at java.lang.reflect.Method.invoke(Native Method)           在com.android.internal.os.Zygote $ MethodAndArgsCaller.run(Zygote.java:240)           在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

1 个答案:

答案 0 :(得分:0)

在imageView中使用较低的图像尺寸。您在imageView中使用的文件太大。这导致了崩溃。