OkHttpProfiler Android Studio Plugin

Overview

OkHttpProfiler Android Studio Plugin

Created by LocaleBro.com - Android Localization Platform

The OkHttp Profiler plugin can show requests from the OkHttp library directly in the Android Studio tool window. It supports the OkHttp v3 (http://square.github.io/okhttp/) and the Retrofit v2 (https://square.github.io/retrofit/)

You can debug OkHttp request or 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.

Screen2


Installation

For installation, you need to include the library to your app build.gradle file

implementation 'com.localebro:okhttpprofiler:1.0.8'

and add Interceptor to okHttpClient in code

For OkHttp
Java
OkHttpClient.Builder builder = new OkHttpClient.Builder();
 if (BuildConfig.DEBUG) {
     builder.addInterceptor(new OkHttpProfilerInterceptor());
 }   
OkHttpClient client = builder.build(); 
Kotlin
val builder = OkHttpClient.Builder()
if (BuildConfig.DEBUG) {
    builder.addInterceptor(OkHttpProfilerInterceptor() )
}    
val client = builder.build()
For Retrofit
Java
OkHttpClient.Builder builder = new OkHttpClient.Builder();
 if (BuildConfig.DEBUG) {
     builder.addInterceptor(new OkHttpProfilerInterceptor());
 }   
OkHttpClient client = builder.build(); 
Retrofit retrofit = new Retrofit.Builder()
            ......
            .client(client)
            .build();
Kotlin
val builder = OkHttpClient.Builder()
if (BuildConfig.DEBUG) {
    builder.addInterceptor( OkHttpProfilerInterceptor() )
}    
val client = builder.build()
val retrofit = Retrofit.Builder()
        ......
        .client(client)
        .build()
For security reasons we recommend to enable OkHttpProfilerInterceptor only for DEBUG BUILDS!

Also Proguard will cut it out in the release build.

And then enable Android Studio plugin

https://plugins.jetbrains.com/plugin/11249-okhttp-profiler

Screen2

Screen3

Screen1

Screen4

Have fun!

Source Codes

OkHttp Profiler Plugin Sources.

OkHttp Profiler Android Library.

Issue with the Android Studio version 4.1 solved in plugin v1.0.13+:

Unfortunately, Google changed realisation of one class but Intellij doesn't. I fixed it, but Intellij IDEA is no longer supported by the OkHttProfiler.

You might also like...
gradle-android-scala-plugin adds scala language support to official gradle android plugin

gradle-android-scala-plugin gradle-android-scala-plugin adds scala language support to official gradle android plugin. See also sample projects at htt

eventbus-intellij-plugin 3.8 0.0 L1 Java Plugin to navigate between events posted by EventBus.
eventbus-intellij-plugin 3.8 0.0 L1 Java Plugin to navigate between events posted by EventBus.

eventbus-intellij-plugin Plugin to navigate between events posted by EventBus. Post to onEvent and onEvent to Post Install There are two ways. Prefere

IntelliJ Idea Astor Plugin is a plugin that integrates Astor in Intellij Idea

IntelliJ Idea Astor Plugin IntelliJ Idea Astor Plugin is a plugin that integrates Astor in Intellij Idea. It communicates with a local/remote program

Intellij-platform-plugin-template - IntelliJ Platform Plugin Template
Intellij-platform-plugin-template - IntelliJ Platform Plugin Template

IntelliJ Platform Plugin Template TL;DR: Click the Use this template button and

BuildPlots-Plugin - PaperMC-Plugin for build contests written in Kotlin.

BuildPlotsPlugin PaperMC-Plugin for build contests. This is my first time using Kotlin and the first plugin I've written after a long time. It is stil

K6-intellij-plugin - IntelliJ-based Plugin to run k6 tests locally or in the k6 Cloud from your IntelliJ IDE
K6-intellij-plugin - IntelliJ-based Plugin to run k6 tests locally or in the k6 Cloud from your IntelliJ IDE

IntelliJ-based Plugin to run k6 tests locally or in the k6 Cloud from your Intel

Ownership-gradle-plugin - Gradle code ownership verification plugin

Gradle code ownership verification plugin A gradle plugin that will verify owner

GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.
GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.

Gradle Play Publisher Gradle Play Publisher is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and

Comments
  • Support for Android 12 emulation?

    Support for Android 12 emulation?

    Love this plugin!!! Doesn't seem to work with Android 12 emulation.

    Also, can I contribute via Paypal. Really don't want to post my credit card to another service.

    Thanks, Gary [email protected]

    opened by dinzdale 1
  • IntelliJ IDEA support?

    IntelliJ IDEA support?

    Hey, I've been using IntelliJ IDEA more recently for android dev and I do switch back to Android Studio to use this awesome plugin. I note the following at the bottom of this README:

    Issue with the Android Studio version 4.1 solved in plugin v1.0.13+: Unfortunately, Google changed realisation of one class but Intellij doesn't. I fixed it, but Intellij IDEA is no longer supported by the OkHttProfiler.

    Can I ask more about this? I would be keen to start an effort to enable IntelliJ IDEA support if I could get some context around this please. Thanks!

    opened by kelvinharron 3
Owner
Ievgenii Tkachenko
Ievgenii Tkachenko
ADB WIFI Android Studio plugin for debug android app over Wi-Fi.

ADB WIFI ADB WIFI Android Studio plugin for debug android app over Wi-Fi. How to install in Android Studio: go to Preferences

Sutachad Wichai 298 Jan 3, 2023
Android Studio plugin which automatically generates drawable selectors from appropriately named resources.

SelectorChapek for Android This Android Studio plugin automatically generates drawable selectors from appropriately named Android resources. How to in

Inmite s.r.o. 1.6k Dec 29, 2022
Android Studio & IntelliJ Plugin for sort xml by name="xxx".

AndroidXmlSorter Android Studio & IntelliJ Plugin for sort xml by name="xxx". Options Insert space between difference prefix ('Snake Case', 'Camel Cas

Kaoru Tsutsumishita 102 Nov 29, 2022
DroidScript plugin example for Android Studio

Plugin-Java This is a basic example/template for building DroidScript plugins using Android Studio v4+ You can make and install the plugin to your dev

droidscript.org 8 Sep 25, 2022
plugin to use to replace text in android studio

replace-text-plugin Template ToDo list Create a new IntelliJ Platform Plugin Template project. Get known with the template documentation. Verify the p

null 1 Nov 29, 2022
This is an android studio plugin that allows you to creates new color in hex format based on a percentage (0-100) and a base color you specify.

alpha-color Description This is an android studio plugin that allows you to creates new color in hex format based on a percentage (0-100) and a base c

null 1 Nov 12, 2021
A plugin for Android Studio that speeds up your day-to-day flutter development.

Flutter-Toolkit 中文文档 A plugin for Android Studio that speeds up your day-to-day flutter development. Flutter ToolKit(Flutter Build Runner Helper), to

苏晟 4 Oct 19, 2022
[Deprecated] Android Studio IDE support for Android gradle unit tests. Prepared for Robolectric.

#[Deprecated] Google has finally released a proper solution for unit testing. Therefore this plugin will no longer be activlty maintained. android-stu

Evan Tatarka 236 Dec 30, 2022
Android Studio plug-in for generating ButterKnife injections from selected layout XML.

ButterKnifeZelezny Simple plug-in for Android Studio/IDEA that allows one-click creation of Butterknife view injections. How to install in Android Stu

Avast 3.4k Dec 14, 2022
An Android Studio / IntelliJ plug-in help you upload your apk or listing to Google Play.

DroidLane An Android Studio / IntelliJ plug-in help you upload your apk or listing to Google Play. Installation Open Android Studio or IntelliJ IDEA O

Jintin 24 Jul 26, 2021