android-studio 0.2.7
Fedora 18
Hello,
I am trying to add the jtwitter jar to my project.
First I tried doing the following:
There are three standard approaches for importing a JAR file into Android studio. The first one is traditional way, the second one is standard way, and the last one is remote library. I explained these approaches step by step with screenshots in this link:
https://stackoverflow.com/a/35369267/5475941.
I hope it helps.
I see so many complicated answer.
All this confused me while I was adding my Aquery jar file in the new version of Android Studio.
This is what I did :
Copy pasted the jar file in the libs folder which is visible under Project view.
And in the build.gradle file just added this line : compile files('libs/android-query.jar')
PS : Once downloading the jar file please change its name. I changed the name to android-query.jar
In the project right click
-> new -> module
-> import jar/AAR package
-> import select the jar file to import
-> click ok -> done
1:
2:
3:
You will see this:
This is how you add jar files from external folders
1) Click on File and there you click on New and New Module
2) New Window appears ,,There you have to choose the Import .JAR/.AAR package .
3) Click on the path option at the top right corner of the window ...And give the whole path of the JAR file .
4)click on finish.
Now you have added the Jar file and You need to add it in the dependency for your application project
1)Right click on app folder and there you have to choose Open Module Settings or F4
2)Click on dependency at the top right corner of the current window .
3)Click on '+' symbol and choose 'Module Dependency' and It will show you the existed JAR files which you have included in your project ...
Choose the one you want and click 'OK/Finish'
Thank you
The easy and correct way to import a jar/aar into your project is to import it as a module.
New
-> Module
Import .JAR/.AAR
PackageThis is the way I just did on Android Studio version 1.0.2
At this point Gradle will rebuild the project importing the library and resolving the dependencies.