Android Plugin For Unity

In this tutorial I am going share how to make a plugin for android using Android Studio  and  Unity. I used Unity 2017.2 but you can use any version you want. Make sure your version of Unity is greater than 5.6. All the versions after 5.6 support AAR file. I think AAR files are the easiest way to create plugins.

  • First of all create a New Project in Android Studio.
  • Don’t add  any activities to It.
  • Create a new Library project but don’t add any activities.
  • Right click on the module and add empty activity.
  • By default the activity will extend from AppcompactActivity.
  • AppcompactActivity has several other dependencies which require several aar files.We can overcome this challenge by using Gradle in Unity but I will share more about it another tutorial.
  • Change it from AppcompactActivity to Activity.
  • Then add another class to the module named
  • We will use bridge class to Interact with our  activity.
  • Go to Builds and click on make mopdule”name of module”. It will produce the aar files in outputs folder.
  • Copy the the AAR files to your Unity project.

Here are few of the codes.

In Bridge.Java

In Unity yourscript.cs







I do what I love. There is a famous quote "Love the process not the product " & I think this is what differentiates developers from consumers .