Android Studio: How to create a .jar file

As per mentioned by the title for today, I would do some sharing on how to create jar file for android studio. This method might not be the only solution but it definitely is working one. I came across this how to because i have a task back with my work at office. I have to compile a my program to jar library. After few research on google, I found one way that have a more neat step and decide to give it a go. 
(there are so many method posted but I have no confident to try it and some are very confusing)

Okay, let's get started.

First, of course you need to have your program ready in a normal project folder. Then you shall proceed with the steps below:

Create a new module for the jar library.



Choose android library

Name your library


After you have successfully create the module, open the build.gradle of the module


You shall add on the two task as below and createJar. Follow exactly as follow except for the library name


Then at the gradle tab, go to "other" of the library folder...

click on the create jar to create the jar file



Upon build success, you can find the jar file created. Voila, your library is now ready to be used!


I have just tested it this today and so happy that it works. Happy sharing.

x



Comments

Popular posts from this blog

What I eat in Kuching

How to automatically generate getter and setter for android studio

无影的压力