Originally using Gsonconvertor, there is no problem on Android version 5.1.1, the result is switched to version 6.0.1, the following problem appears:
- Java.lang.IllegalArgumentException:Unable to create converter for java.util.list<model>
, StackOverflow has a post to talk about this issue http://stackoverflow.com/questions/34315499/ Unable-to-create-converter-for-java-util-list-retrofit-2-0-0-beta2. But my own code is like the answer, so the answer is useless, look at the retrofit document, the Convertor library from Gson to Jackson, solve the problem, but Jackson is flawed, it is the JSON object interface field definition requirements are relatively strict, If there are objects in the JSON that do not define the field will be error, this very limited version of the interface upgrade, there is no way back to continue to solve the problem of Gson. Gson, the root cause of the problem is:
- Java.lang.SecurityException:Can ' t make Field constructor accessible
Originally this is an Android M preview version of the issue, Gson official has also admitted, plus I also used the activeandroid, the solution:
- gsonbuilder builder = < span class= "keyword" >new gsonbuilder ();
- builder.excludefieldswithmodifiers ( modifier.final, modifier.transient, modifier.static);
- Gson gson = builder.create ();
-
- &NBSP;&NBSP;
- Retrofit = new retrofit.builder ()
-
- .addconverterfactory (Gsonconverterfactory.create (Gson))
- .client (client)
- .build ();
Java.lang.SecurityException:Can ' t make Field constructor accessible