Essential Android Retrofit2 edit forum

Debugging with Stetho

Add the following dependencies to your application.

compile 'com.facebook.stetho:stetho:1.5.0' 
compile 'com.facebook.stetho:stetho-okhttp3:1.5.0'

In your Application class’ onCreate method, call the following.

Stetho.initializeWithDefaults(this);

When creating your Retrofit instance, create a custom OkHttp instance.

OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
clientBuilder.addNetworkInterceptor(new StethoInterceptor());

Then set this custom OkHttp instance in the Retrofit instance.

Retrofit retrofit = new Retrofit.Builder()
    // ...
    .client(clientBuilder.build())
    .build();

Now connect your phone to your computer, launch the app, and type chrome://inspect into your Chrome browser. Retrofit network calls should now show up for you to inspect.


Table Of Contents
37 Retrofit2
39 ACRA
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close