App crashes (sometimes) with Fatal signal 11 (SIGSEGV), code 1

江枫思渺然 提交于 2019-11-29 03:43:33
Yvette Colomb

1) Firstly determine whether it's a bug within the android, the third party libraries or your device, so you can know which way to proceed.

This answer gives a solution of how to do this:

If you have written (or are using) a plugin that in turn uses native C/C++ code through the NDK, this may indicate a bug in that native code.

Otherwise, this is a bug in the firmware of the device or emulator you are testing upon.

If you can reproduce this in an emulator, on a Nexus device with the original ROM, or on a variety of devices from different manufacturers, it is probably a bug in Android itself. In that case, please create a sample project that can reproduce the error, and post it along with the entire stack trace to http://b.android.com, the Android OS issue tracker.

If you are only encountering this on one device or one third-party ROM, it is probably a more specific bug -- your best bet is to contact the device manufacturer or ROM publisher with your symptoms.

There are these two questions which discuss the error you are receiving in detail:

Android Fatal signal 11 (SIGSEGV) at 0x636f7d89 (code=1). How can it be tracked down?

Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1) - PhoneGap

2) In terms of parsing your geobounds values (as it would seem is where the problem may lie), ensure you are handling your parsing between Gson and Json correctly, with the correct geobound values. It appears how you are storing the values is not in accord with how you are retreiving them.

From Mykong:

toJson() – Convert Java object to JSON

Gson gson = new Gson();
Staff obj = new Staff();

// 1. Java object to JSON, and save into a file
gson.toJson(obj, new FileWriter("D:\\file.json"));

// 2. Java object to JSON, and assign to a String
String jsonInString = gson.toJson(obj);

fromJson() – Convert JSON to Java object

Gson gson = new Gson();

// 1. JSON to Java object, read it from a file.
Staff staff = gson.fromJson(new FileReader("D:\\file.json"), Staff.class);

// 2. JSON to Java object, read it from a Json String.
String jsonInString = "{'name' : 'mkyong'}";
Staff staff = gson.fromJson(jsonInString, Staff.class);

// JSON to JsonElement, convert to String later.
JsonElement json = gson.fromJson(new FileReader("D:\\file.json"), JsonElement.class);
String result = gson.toJson(json);

From this answer:

public class YourObject {
   private String appname;
   private String Version;
   private String UUID;
   private String WWXY;
   private String ABCD;
   private String YUDE;
   //getters/setters


YourObject parsed = new Gson().fromJson(jsons, YourObject.class);  

String jsons = "{'appname':'application', 'Version':'0.1.0', 'UUID':'300V', 'WWXY':'310W', 'ABCD':'270B', 'YUDE':'280T'}";
YourObject parsed = new Gson().fromJson(jsons, YourObject.class);  

JsonObject object = new JsonParser().parse(jsons).getAsJsonObject();
object.get("appname"); // application 
object.get("Version"); // 0.1.0

These SO questions give more details:
How to parse json parsing Using GSON in android
parse JSON with gson and GsonBuilder()

3) Ensure you are passing the correct values for your geobound co-ords. This question Value does not fall within the expected range GeoboundingBox WinRT (although it is C# gives a good example of how to break down the components of information you are trying to store and retrieve.

The answer is straightforward.

var nw = new BasicGeoposition();
nw.Latitude = Max(pos.Coordinate.Latitude, pos2.lat);
nw.Longitude = Min(pos.Coordinate.Longitude, pos2.lng);
var se = new BasicGeoposition();
se.Latitude = Min(pos.Coordinate.Latitude, pos2.lat);
se.Longitude = Max(pos.Coordinate.Longitude, pos2.lng);

And learn how to parse your json with gson:

Use Gson to work with JSON in your Android apps

There is also this gihub repo for you to browse for more ideas.

Can you paste any more info from adb logcat? It is currently not enough information for us to help you out. A segfault in the finalizer daemon can imply double deletion of native objects. Without more information, it could be anywhere in the OS or in the SDK.

The skipped frames means your app is processing lots of data in the main thread. Skipping 161 frames means over 3s of busy time! Please try to use AsyncTasks or threads to optimize your app.

It seems you are using GSON type deserializer, which will not construct our native objects correctly. Manually deserializing the lat, lng and calling new GeoBoundingBox() will not crash.

I have resolved same issue by following code.

Add android:vmSafeMode="true" in application tag in Manifest file.

Your application tag should looks like:

<application
    android:name=".MyApplication"
    android:hardwareAccelerated="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:theme="@style/AppTheme"
    android:vmSafeMode="true">

    // Other stuff

 </application>

Hope this will help you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!