Android 开发者控制台中神秘的堆栈跟踪(位图大小超过 32 位)
我在开发者控制台中收到以下堆栈跟踪。一些报告称“应用程序无法启动”或“启动时崩溃”。
我不知道该怎么办,它没有在我的应用程序的类中提及任何内容!有人遇到同样的错误并找到解决方法吗?
java.lang.IllegalArgumentException: bitmap size exceeds 32bits
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:695)
at android.view.View.buildDrawingCache(View.java:6646)
at android.view.ViewGroup.onAnimationStart(ViewGroup.java:1345)
at android.view.ViewGroup.drawChild(ViewGroup.java:1591)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.View.draw(View.java:6996)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.View.draw(View.java:6996)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2054)
at android.view.ViewRoot.draw(ViewRoot.java:1632)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1335)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1991)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:4358)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
at dalvik.system.NativeStart.main(Native Method)
I'm getting the following stacktrace in the developer console. Some report say "the application won't start" or "crash at startup".
I don't know what to do, it doesn't mention any on my app's class! Anyone got the same error and found a fix?
java.lang.IllegalArgumentException: bitmap size exceeds 32bits
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:695)
at android.view.View.buildDrawingCache(View.java:6646)
at android.view.ViewGroup.onAnimationStart(ViewGroup.java:1345)
at android.view.ViewGroup.drawChild(ViewGroup.java:1591)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.View.draw(View.java:6996)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.View.draw(View.java:6996)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2054)
at android.view.ViewRoot.draw(ViewRoot.java:1632)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1335)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1991)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:4358)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
at dalvik.system.NativeStart.main(Native Method)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果是数量问题,则必须 回收 你的位图。
如果是大小问题(无法加载太大的图像),则必须加载位图的较轻副本。
以下是创建较小图像的代码
inSampleSize设置一个值> 1、请求解码器对原始图像进行子采样,返回较小的图像以节省内存。
使用 2 的幂会更有效。
这篇文章 可能有用
if it 's a matter of quantity, you have to recycle your bitmaps.
if it's a matter of size (you can't load too big images), you have to load a lighter copy of your bitmap.
Here is the code to create a smaller image
inSampleSize set to a value > 1, requests the decoder to subsample the original image, returning a smaller image to save memory.
Use a power of 2 for it to be more efficient.
This post may be useful
首先确保您的 x、y、宽度和高度值小于源位图。
对我来说问题是矩阵。我的矩阵有一个平移值,该值将其中一个值带到输入位图的边界之外。
希望这有帮助
First make sure your x, y, width and height values are smaller than the source bitmap.
The issue for me was the matrix. My matrix has a translation value which brought the one of the values outside of the bounds of the input bitmap.
Hope this helps
就我而言,此字符串中有错误:
Crash was only on API 18 and less
In my case it was error in this string:
Crash was only on API 18 and less