Ho il mio retrofit impostato con HttpLoggingInterceptor
come questo:Come stampare in Retrofit 2?
Gson gson = new GsonBuilder()
.setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ")
.setPrettyPrinting() // Pretty print
.create();
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder()
.addInterceptor(interceptor)
.build();
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create(gson))
.client(client)
.build();
Sul mio esempio GSON, ho fatto setPrettyPrinting
e ho ancora ottenere uscite JSON compatte. Ecco le mie librerie.
compile 'com.google.code.gson:gson:2.5'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
compile 'com.squareup.okhttp3:okhttp:3.0.1'
Come posso ottenere una bella stampa utilizzando Retrofit 2? Grazie.
EDIT: aggiornato il mio librerie e ancora non ha funzionato
provato con l'ultima beta4 e ancora non ha funzionato. – Schinizer