• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Android Studio plugin for an OkHttp/Retrofit requests profiling

Is the OkHttp Profiler plugin useful?

  • Useful plugin. I will use it

    Votes: 0 0.0%
  • Useful plugin, but I will not use it, I am using another debug method

    Votes: 0 0.0%
  • I don't work with the OkHttp/Retrofit

    Votes: 0 0.0%
  • I don't like it. Will not use

    Votes: 0 0.0%
  • I'm not sure

    Votes: 0 0.0%

  • Total voters
    0

gektor650

Lurker
Hi all!
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.2'
}

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:

Java:
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
 
Back
Top Bottom