使用 Stetho 进行调试
将以下依赖项添加到你的应用程序。
compile 'com.facebook.stetho:stetho:1.5.0' 
compile 'com.facebook.stetho:stetho-okhttp3:1.5.0' 
在你的 Application 类’onCreate 方法中,调用以下内容。
Stetho.initializeWithDefaults(this);
创建 Retrofit 实例时,请创建自定义 OkHttp 实例。
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
clientBuilder.addNetworkInterceptor(new StethoInterceptor());
然后在 Retrofit 实例中设置此自定义 OkHttp 实例。
Retrofit retrofit = new Retrofit.Builder()
    // ...
    .client(clientBuilder.build())
    .build();
现在将手机连接到计算机,启动应用程序,然后在 Chrome 浏览器中键入 chrome://inspect。现在应该显示改造网络呼叫以供你检查。