Add Android Studio, external java library (.JAR, .AAR)

By | February 25, 2017

To use an external Java package in Android Studio, you need to do some work on the IDE’s project settings. I thought that Android studio might be similar to eclipse, but It was different with eclipse method.

Below step is for Android Studio.

1) Select [File]> [Project Structure …]


2) Select the “+” (New Module) button on the upper left corner of the popup that occurs after the “Project Structure…” selection.


3) Select “Import .JAR / .AAR Package” from the selectable items.


4) You may do not know what to do here. You may be puzzled for a moment.
Select the .JAR file you want to add by clicking the “…” button on the right.


5) Select “Finish” button.


6) If the external package you want to use is commons-io and gson and you added two, you can see that “coomons-io-2.5” and “gson-2.8.0” are added below “app”.


7) Select the app that is the original project and then select “Dependencies” in the upper right tab.


8) Press the right “+” button to select “Module dependency”.


9) Select the desired module. (Duplicate selectable)


10) You can see that it is added to “Dependencies” as shown below.


Now you can use the added library.


Leave a Reply

Your email address will not be published. Required fields are marked *