致命信号11(SIGSEGV)在0x00000000(代码= 1),线程32140

时间:2013-06-20 11:00:33

标签: android fatal-error crash-reports android-logcat

运行我的应用程序时有50%的时间我收到此错误

06-20 12:56:51.183: A/libc(32140): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 32140 (example.www)

我只需重新打开应用程序然后就可以了。但我不知道为什么我收到此错误并且应用程序崩溃了。 我正在处理尺寸很大的大图像,大约1200x1200像素并将其设置为背景。我还将该图像用作其他一些活动的位图作为背景。还做一些调用服务器并获取JSON数据。 希望我提供足够的信息,因为我不知道该找什么... 我正在为4.1.2开发

完成Logcat

   06-20 13:02:38.823: W/ActivityThread(4102): Application eu.sexample.www can be debugged on port 8100...
06-20 13:02:38.983: D/dalvikvm(4102): GC_FOR_ALLOC freed 114K, 7% free 12283K/13191K, paused 13ms, total 13ms
06-20 13:02:38.988: I/dalvikvm-heap(4102): Grow heap (frag case) to 18.398MB for 5954576-byte allocation
06-20 13:02:39.008: D/dalvikvm(4102): GC_CONCURRENT freed 1K, 5% free 18096K/19015K, paused 12ms+1ms, total 22ms
06-20 13:02:39.053: D/dalvikvm(4102): GC_FOR_ALLOC freed 0K, 5% free 18097K/19015K, paused 10ms, total 10ms
06-20 13:02:39.088: I/dalvikvm-heap(4102): Grow heap (frag case) to 41.112MB for 23818256-byte allocation
06-20 13:02:39.103: D/dalvikvm(4102): GC_CONCURRENT freed 0K, 3% free 41357K/42311K, paused 3ms+1ms, total 16ms
06-20 13:02:39.168: D/dalvikvm(4102): GC_FOR_ALLOC freed 5815K, 16% free 35916K/42695K, paused 10ms, total 10ms
06-20 13:02:39.193: E/Location(4102): 51.1878642, 4.3802626
06-20 13:02:39.283: D/libEGL(4102): loaded /system/lib/egl/libEGL_mali.so
06-20 13:02:39.283: D/libEGL(4102): loaded /system/lib/egl/libGLESv1_CM_mali.so
06-20 13:02:39.288: D/libEGL(4102): loaded /system/lib/egl/libGLESv2_mali.so
06-20 13:02:39.288: D/(4102): Device driver API match
06-20 13:02:39.288: D/(4102): Device driver API version: 10
06-20 13:02:39.288: D/(4102): User space API version: 10 
06-20 13:02:39.288: D/(4102): mali: REVISION=Linux-r2p4-02rel0 BUILD_DATE=Tue Oct 16 15:37:13 KST 2012 
06-20 13:02:39.323: D/OpenGLRenderer(4102): Enabling debug mode 0
06-20 13:02:42.413: D/dalvikvm(4102): GC_FOR_ALLOC freed 448K, 14% free 37130K/42695K, paused 13ms, total 13ms
06-20 13:02:42.423: I/dalvikvm-heap(4102): Grow heap (frag case) to 42.664MB for 5954576-byte allocation
06-20 13:02:42.433: D/dalvikvm(4102): GC_CONCURRENT freed 4K, 12% free 42941K/48519K, paused 2ms+2ms, total 13ms
06-20 13:02:42.478: D/dalvikvm(4102): GC_FOR_ALLOC freed 0K, 12% free 42941K/48519K, paused 10ms, total 10ms
06-20 13:02:42.478: I/dalvikvm-heap(4102): Forcing collection of SoftReferences for 23818256-byte allocation
06-20 13:02:42.498: D/dalvikvm(4102): GC_BEFORE_OOM freed 9K, 12% free 42931K/48519K, paused 19ms, total 19ms
06-20 13:02:42.498: E/dalvikvm-heap(4102): Out of memory on a 23818256-byte allocation.
06-20 13:02:42.498: I/dalvikvm(4102): "main" prio=5 tid=1 RUNNABLE
06-20 13:02:42.498: I/dalvikvm(4102):   | group="main" sCount=0 dsCount=0 obj=0x41585508 self=0x415758c8
06-20 13:02:42.498: I/dalvikvm(4102):   | sysTid=4102 nice=0 sched=0/0 cgrp=apps handle=1074532144
06-20 13:02:42.498: I/dalvikvm(4102):   | schedstat=( 2709445063 154759556 1906 ) utm=227 stm=43 core=2
06-20 13:02:42.498: I/dalvikvm(4102):   at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
06-20 13:02:42.498: I/dalvikvm(4102):   at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:623)
06-20 13:02:42.498: I/dalvikvm(4102):   at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:476)
06-20 13:02:42.503: I/dalvikvm(4102):   at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
06-20 13:02:42.503: I/dalvikvm(4102):   at android.content.res.Resources.loadDrawable(Resources.java:1963)
06-20 13:02:42.503: I/dalvikvm(4102):   at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
06-20 13:02:42.503: I/dalvikvm(4102):   at android.view.View.<init>(View.java:3436)
06-20 13:02:42.503: I/dalvikvm(4102):   at android.view.View.<init>(View.java:3371)
06-20 13:02:42.503: I/dalvikvm(4102):   at android.view.ViewGroup.<init>(ViewGroup.java:426)
06-20 13:02:42.503: I/dalvikvm(4102):   at android.widget.RelativeLayout.<init>(RelativeLayout.java:184)
06-20 13:02:42.503: I/dalvikvm(4102):   at java.lang.reflect.Constructor.constructNative(Native Method)
06-20 13:02:42.503: I/dalvikvm(4102):   at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
06-20 13:02:42.508: I/dalvikvm(4102):   at android.view.LayoutInflater.createView(LayoutInflater.java:587)
06-20 13:02:42.508: I/dalvikvm(4102):   at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
06-20 13:02:42.508: I/dalvikvm(4102):   at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
06-20 13:02:42.508: I/dalvikvm(4102):   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
06-20 13:02:42.508: I/dalvikvm(4102):   at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
06-20 13:02:42.508: I/dalvikvm(4102):   at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
06-20 13:02:42.508: I/dalvikvm(4102):   at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
06-20 13:02:42.508: I/dalvikvm(4102):   at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:308)
06-20 13:02:42.508: I/dalvikvm(4102):   at android.app.Activity.setContentView(Activity.java:1924)
06-20 13:02:42.508: I/dalvikvm(4102):   at eu.sexample.www.MainActivity.onCreate(MainActivity.java:28)
06-20 13:02:42.508: I/dalvikvm(4102):   at android.app.Activity.performCreate(Activity.java:5206)
06-20 13:02:42.508: I/dalvikvm(4102):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
06-20 13:02:42.508: I/dalvikvm(4102):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
06-20 13:02:42.508: I/dalvikvm(4102):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
06-20 13:02:42.508: I/dalvikvm(4102):   at android.app.ActivityThread.access$600(ActivityThread.java:140)
06-20 13:02:42.508: I/dalvikvm(4102):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
06-20 13:02:42.508: I/dalvikvm(4102):   at android.os.Handler.dispatchMessage(Handler.java:99)
06-20 13:02:42.508: I/dalvikvm(4102):   at android.os.Looper.loop(Looper.java:137)
06-20 13:02:42.508: I/dalvikvm(4102):   at android.app.ActivityThread.main(ActivityThread.java:4898)
06-20 13:02:42.508: I/dalvikvm(4102):   at java.lang.reflect.Method.invokeNative(Native Method)
06-20 13:02:42.508: I/dalvikvm(4102):   at java.lang.reflect.Method.invoke(Method.java:511)
06-20 13:02:42.513: I/dalvikvm(4102):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
06-20 13:02:42.513: I/dalvikvm(4102):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
06-20 13:02:42.513: I/dalvikvm(4102):   at dalvik.system.NativeStart.main(Native Method)
06-20 13:02:42.513: A/libc(4102): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 4102 (example.www)

3 个答案:

答案 0 :(得分:32)

真正的错误是Out of memory on a 23818256-byte allocation。您正在尝试分配一个~22MB的内存块,并且您没有那么多可用内存,更不用说一个大的连续块。

在这种情况下,这来自可绘制资源。 ~22MB将是一个真正庞大的图像,更像2400x2400而不是1200x1200。

你的进程堆大小是48MB,这是实质性的,但是~22MB几乎是你的堆预算的一半。

我建议您找出这是哪个可绘制资源(看起来它可能是RelativeLayout的背景),然后减小其大小和类似图像的大小。在这里,“大小”是指总像素数,而不是磁盘大小,重要的是RAM中的解压缩大小,而不是磁盘上的图像大小。

此外,这可能是资源目录的问题。例如,如果您将1200x1200图像放在res/drawable/中,则实际上它与res/drawable-mdpi/同义。如果此设备恰好是-xhdpi设备,则会解释内存使用情况,因为Android会尝试对此图像进行上采样并将每个维度加倍。

答案 1 :(得分:3)

在你的AndroidMenifest中。

<application.... android:hardwareAccelerated="false" />

适合我。

答案 2 :(得分:0)

在XML布局中用LinearLayout替换FrameLayout