Originally using Gsonconvertor, there was no problem with the Android version 5.1.1, the result was switched to version 6.0.1, and the following problems occurred:
Java.lang.IllegalArgumentException:Unable to create converter for java.util.list<model>
, StackOverflow has a post to talk about the problem 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 has a flaw, it on the JSON Object interface field definition requirements are more stringent, If there is an object in JSON that doesn't have a definition, it's going to be error, which is very limiting the version upgrade of the interface, and there's no way to go back and solve the Gson problem. The Gson of the problem is that the root cause of the error is:
Java.lang.SecurityException:Can ' t make Field constructor accessible
Originally this is an Android M preview version of the issue, Gson has also admitted that, plus I also used the activeandroid, the solution:
Gsonbuilder builder = new Gsonbuilder ();
Builder.excludefieldswithmodifiers (modifier.final, modifier.transient, modifier.static);
Gson Gson = Builder.create ();
Retrofit = new Retrofit.builder ()
. BaseURL (BaseURL)
. Addconverterfactory (gsonconverterfactory.create )
. Client (client)
. Build ();