[FREE] Android Studio plugin for an OkHttp/Retrofit requests profiling

gektor650

Member
Oct 29, 2018
6
0
0
Visit site
Hi! Let me introduce the OkHttp Profiler plugin for an Android Studio and an IntellijIDEA. It can show HTTP/HTTPS request details in the IDE tool window. You can explore request/response headers, inspect the JSON as a tree, as a plain text etc. And you can easily create a Java/Kotlin model from the data. Just click the right mouse button on a root element of the tree (or any other), choose Java or Kotlin, and select a folder for a new file in the project (for example project/app/src/main/java/com/example/data).


To activate, just add the library to the Android Gradle file (build.gradle) in your module (application/app/build.gradle)

Code:
dependencies {
    //……………
    implementation 'com.itkacher.okhttpprofiler:okhttpprofiler:1.0.3'
}

Sync the Gradle project to apply the changes and set an interceptor to the OkHttp client by adding the following code to OkHttp client or Retrofit:

Code:
OkHttpClient.Builder builder = new OkHttpClient.Builder();
if (BuildConfig.DEBUG) {
    builder.addInterceptor(new OkHttpProfilerInterceptor());
}
OkHttpClient client = builder.build();

Now open Android Studio preferences, select the "Plugins" tab, then "Browse repositories" and type "OkHttp Profiler" into a search field.
Press "Install" and "Restart".

The plugin will appear in right bottom corner of the Android Studio
toolwindow.png

If you find any issue feel free to create it by link or write here
https://github.com/itkacher/OkHttpProfiler/issues
 
Last edited: