My Hexaville
Spead the Word

Android Studio Creating Plugins Easy

android studio create plugin
Designed by Freepik

Hi, If you want some Android Studio plugin which does not exist you probably were thinking about creating them by your own,  but if you haven’t created those, it might seem like that’s too hard. It’s not. And since Android Studio/IDEA runs for JVM, we use Java or Kotlin. Let’s start with a setting up and creating a simple motivational quote poping up on IDE’s launch, then we’ll get into more complex stuff!


What you’ll need for development is IDEA Community edition because Android Studio doesn’t have a plugin creation wizard. You can get it here. Then download IDEA community source code with this command

You can check the repository itself here. After cloning run depending on your OS.

Open this project in IDEA, the go to File/Project Stucture/SDKs. Select 1.8 and click green add button or the right.

android studio create plugin

add tools.jar file from jdk/lib folder.

android studio create plugin

Now add new SDK by clicking on left green add button, select JDK, choose path to your JDK and then rename this SDK to IDEA jdk. Add tools.jar for it just like you did for 1.8

Finally click Build/Make Project if it build successfuly – then run IDEA, just to test it.

.android studio create plugin

If you got another IDE launched – congrats, you have one last thing to setup is add a new SDK. Select Intellij Platform Plugin SDK

android studio create plugin

Select IDEA Community edition home directory

android studio create plugin

Choose IDEA jdk as a default SDK. Then select newly created SDK and choose Sourcepath tab, click add button at the right and choose repo that you cloned in the beginning. Now you’re done with setup, let’s make our first plugin!

Create Plugin Project

Click File/New Project/Intellij Platform Plugin and Intellij IDEA Community should be your Project SDK.

android studio create plugin

What you’ll have is a simple project, make sure you resources/META-INF/plugin.xml and in your .iml file it says type=”PLUGIN_MODULE”. Next let’s test if it build correctly, if you don’t have a build config created by default go to Run/Edit Configurations and create a new Plugin config

android studio create plugin

Then run it, you should have another IDE launching. If there’s any issues – fix them before going next

Launcher Plugin

What want to create now is for plugin to run on IDE startup, this can be done with Application Component. Create one from this menu.

android studio create plugin

This will create component tag in plugin.xml and create a new Java class. You can convert it to Kotlin, no other setup required for it.

Let’s write some code

In our newly created class we have three overriden methods: initComponet, disposeComponent, getComponentName. In initComponent we will write our code for IDE sturtup time. What we’ll have is this popup on the right bottom side like we often have.

android studio create plugin

There might be no documentation for each action that you want to have, but the best thing is you have your IDE’s source code by your hand, it’s in Java and you can find it yourself. For example to find how to display this kind popup I used this command

That’s one of the messages that appear with this kind of popup. Now this search can be very slow, up to 10-15 minutes. It led me to the actual Java code. That’s the code that you’ll need to create one

Build It

Just replace with some hardcoded text for now, try to run it, if it shows up, then let’s build and install it for our IDE.

Click Build/Prepare Plugin module… This will create a jar file in the root of your project. Now open Android Studio, go to File/Settings/Plugins/Install Plugin from disk and select your jar file.

Congratulations on creating your first plugin!

Fetch Quotes

The final touch is having actual quotes which do not repeat. I fetch quotes from this site using jsoup library. The website is static, no JavaScript generated content, so scraping them is piece of cake, just check the jsoup documentation and display a random each time.

To add this library go to File/Project Settings/Libraries and add it from Maven by searching and dowload it to lib folder

android studio create plugin

After building this plugin you’ll have a zip file instead


Alright, we setup our development environment for creating plugins, created our first plugin. In the next posts we’ll something more complex. You can get source code here

Don’t forget to subscribe, follow me on Twitter, Facebook, G+ and share with friends if you think they will benefit from it!




About the Author Ihor Klimov

Formerly an Android developer, lately picked up some Flutter. This blog is everything that I find exciting about Android and Flutter development. Stay tuned and hope to see you again!