奇怪的崩溃在画布上的Android 4.0.3绘制。 A / libc中:致命信号11(SIGSEGV) [英] Strange crash drawing on canvas on Android 4.0.3. A/libc: Fatal signal 11 (SIGSEGV)
问题描述
我使用的是低成本的平板电脑采用Android 4.0.3。在这里,日志:
I'm using a low cost tablet with Android 4.0.3. Here the log:
06-11 23:36:04.653: D/SynopticElement(1583): Size changed to 200x200
06-11 23:36:04.693: D/dalvikvm(1583): GC_FOR_ALLOC freed 62K, 12% free 7275K/8199K, paused 33ms
06-11 23:36:04.713: D/SynopticElement(1583): Size changed to 190x190
06-11 23:36:04.733: D/dalvikvm(1583): GC_FOR_ALLOC freed 9K, 12% free 7583K/8583K, paused 22ms
06-11 23:36:04.743: A/libc(1583): Fatal signal 11 (SIGSEGV) at 0xc52c9d4c (code=1)
我的调试code:
Debugging my code:
canvas.scale(getWidth(), getWidth()); //I'm drawing a custom component
Paint frameBackgroundPainter = new Paint();
frameBackgroundPainter.setAntiAlias(true);
frameBackgroundPainter.setStyle(Paint.Style.FILL);
frameBackgroundPainter.setColor(0xff000000);
Paint frameBorderPainter = new Paint();
frameBorderPainter.setAntiAlias(true);
frameBorderPainter.setStrokeWidth(0.007f); //canvas is scaled
frameBorderPainter.setStyle(Paint.Style.STROKE);
frameBorderPainter.setColor(0xffaaaaaa);
RectF frameRect = getFrameBorder(); //simply get the Rect to draw on canvas
canvas.drawRect(frameRect, frameBackgroundPainter); //draw the background
// ---> If I comment this line app does not crash!!!!! <---
canvas.drawRect(frameRect, frameBorderPainter); //draw the border
有一个的问题与油漆笔画宽度,我tryed使用不同的值:
There's a problem with the paint stroke width, I tryed with different values:
0.007f -> crash
0.009f -> crash
0.5f -> ok
0.1f -> ok
有人可以告诉我,因为对线宽非常低的值有不同的画布规模的工作:确定,但一切都很好,如果我设置宽度= 0.007f
并在Android 2.3(平板电脑和手机)和Android 3.0(平板电脑)运行应用程序...
Someone may tell me to work with a different canvas scale because of the very low value for the line width: ok, but everything is ok if I set width=0.007f
and run the app on Android 2.3 (tablet and phone) and Android 3.0 (tablet)...
我不excpetcing任何解决方案来绘制边界以不同的方式,我想知道如果任何人知道,如果这是安卓4.0.3。
I'm not excpetcing any solution to draw border in a different way, I'm wondering if anyone knows if this is a bug of Android 4.0.3.
我也想这可能是我的低成本平板电脑的图形硬件问题,可惜的是我没有其他Android 4.0.3设备进行测试...
I'm also thinking it may be a graphic hardware issue of my low cost tablet, unfortunatelly I've no other Android 4.0.3 device to make tests...
我的标签指标:
DisplayMetrics{density=1.0, width=480, height=752, scaledDensity=1.0, xdpi=160.0, ydpi=160.42105}
和有关设备的访问此链接的更多信息。
and for more information about the device visit this link.
推荐答案
停在英特尔的x86 AVD一个OpenGL-ES应用程序时,这是一个常见的错误(每次启动时崩溃的onStop())。这里有一个快速的解决方案:
- 打开AndroidManifest.xml中,添加机器人:allowClearUserData =真标签的应用程序节点。
This was a common error when stopping an OpenGL-ES app on Intel x86 AVD (every launch crashes at onStop()). Here's a quick solution:
- Open AndroidManifest.xml, add android:allowClearUserData="true" tag to the application node.
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:allowClearUserData="true" >
这篇关于奇怪的崩溃在画布上的Android 4.0.3绘制。 A / libc中:致命信号11(SIGSEGV)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!