private static void initOkHttpClient() {
if (okHttpClient == null) {
synchronized (RetrofitHelper1.class) {
if (okHttpClient == null) {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
okHttpClient = new OkHttpClient.Builder()
.addInterceptor(interceptor)
.build();
}
}
}
}
注意要添加OKLog的依赖!