Adding external library in Android studio
Try this:
File > Project Structure > Dependencies Tab > Add module dependency (scope = compile
)
Where the module dependency is the project library Android folder.
Try one of these approaches:
Approach 1)
1- Choose project view
2- Copy your JAR file in app -> lib folder
3- Right click on your JAR file and choose add as library
4- Check it in build.gradle
Approach 2)
1- File -> New -> New Module
2- Import .JAR/.AAR Package
3- Browse your JAR File
4- Finish
5- File -> Project Structure -> Dependencies
6- You should click on + button and then click on Module Dependency
7- You will see your library here
8- choose your library and click ok
9- Then, you will see that your library is added.
For first two approaches, you need a JAR file. You can search http://search.maven.org/ to find JAR files that are related to Android. For example, this is the search result for jdom in this link
Approach 3) Android is using http://jcenter.bintray.com/ as remote library. For example, this is the search result for jdom in the link.
To add a library in this approach, please follow these steps:
1- File -> Project Structure -> Dependencies
2- Click on + button and choose library dependency
3- find your library and select it, then click OK.
I hope it helps.