Android Studio has a lot of plugins that help increase your productivity. This article contains a list of 3 plugins that helps me a lot out of so many amazing ones.
First of all, what is a plugin?
A plugin is a software component that adds a specific feature to an existing system. In Android studio, there are a lot of plugins available for different purposes. You can install them according to your requirements.
How to install plugins in Android Studio?
- In Android Studio, go to Android Studio -> Preferences
2. This will show the Preferences dialog. From the left panel, select Plugins.
3. This will show the plugins section which has two tabs. One shows the Marketplace from which you can install the plugins and the other tab shows the Installed plugins that you have. You can also read about the plugin in this popup.
4. On installing a plugin, Android Studio may ask you to restart to get the effect.
Let’s get to some plugins now.
JsonToKotlin is a plugin to create Kotlin data class from JSON string. You can click over the folder where you want to create the data class file and click on New -> Kotlin data class File from JSON. It will open a popup where you can put the JSON text and name of the class. There is an advanced option which will let you put some default settings.
- You can set the property keyword. If you want the new Kotlin data class to have val or var properties.
- You can set the property type. If you want it to be nullable, non-nullable or you want it to auto determine from the JSON value.
- It also lets you set a default value strategy. You can choose if you want it to not initialise the default value or initialise it with null or not.
- You can also set the annotation to be used in the Kotlin data class. Both for class and properties.
- There are some other options as well where you can set the order and indents etc.
Import Figma Resources plugin
Import Figma Resources plugin lets you import Figma exported ZIP file containing PNG files by matching its suffixes with density folders. To find it, you can click over the res folder and there you will get an option Import Figma Resources. When you click on that, it will show an import dialog where you have to select the zip file that you have exported from Figma. On selecting the zip, the file name will be filled and it can be edited if required. The matched and non-matched suffixes will show an icon on the right side. The “Remember suffixes” check allows to save the given suffixes for the next plugin executions.
The OkHttp Profiler plugin can show requests and their responses from the OkHttp library in the Android Studio tool window. It supports OkHttp v3 and Retrofit v2.
You can debug OkHttp request or response headers, inspect the JSON as a tree, as plain text etc. And you can easily create a Java/Kotlin model from the data.
I was introduced to this plugin by a colleague and it is quite helpful while debugging.
References:
- https://plugins.jetbrains.com/plugin/9960-json-to-kotlin-class-jsontokotlinclass-
- https://plugins.jetbrains.com/plugin/12037-import-figma-resources
- https://plugins.jetbrains.com/plugin/11249-okhttp-profiler
Please feel free to reach out to me on LinkedIn and Twitter.