I'm using Retrofit library for communication with server side. From server I get list of objects
List<BaseAction>
where I store child actions as:ActionUrl, ActionBell, etc.
And I got crash in callback sucсess method
Fatal signal 11 (SIGSEGV), code 1, fault addr 0x610091 in tid 21471
And my question is: What is wrong and why retrofit crash native?
I spend few hours for debugging and find that problem in List. Retrofit cannot correctly deserialize my JSON and convert it to java object.
In Volley I used my own class ActionDeserialize<T> implements JsonDeserializer<T>
where I implement class resolving according to class:
private Type getTypeForType(BTypes bType) {
return bType.getResponseClass();
}
More details about this here
So, I resolve my problem with setting new GsonConverter (after blog reading):
Gson gson = new GsonBuilder()
.registerTypeAdapter(BaseActionPOJO.class, new ActionDeserialize<BaseActionPOJO>())
.create();
RestAdapter restAdapter = new RestAdapter.Builder()
.setLogLevel(loglevel)
.setConverter(new GsonConverter(gson))
.setRequestInterceptor(requestInterceptor)
.setEndpoint(Urls.BASE_URL)
.setClient(new OkClient())
.build();
And it resolve native crash in native part. I hope it will save your time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With