I\'m trying to use the new Android Studio but I can\'t seem to get it working correctly.
I\'m using the Gson library to serialize/deserialize JSON-o
I have read all the answers here and they all seem to cover old versions of Android Studio!
With a project created with Android Studio 2.2.3 I just needed to create a libs
directory under app
and place my jar there.
I did that with my file manager, no need to click or edit anything in Android Studio.
Why it works? Open Build / Edit Libraries and Dependencies and you will see:
{include=[*.jar], dir=libs}
libs
folder at the level of app
. jars
in this project. libs
folder,add library
I observed CTRL + ALT + SHIFT + S --> project structure --> app-module -->Dependencies" already had an entry as (dir: 'libs', include: '*.jar')
under compile-option
, initially. And after adding the jar's as per the steps stated above, the build.gradle
got the entries for the new added jar's, itself.
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:
Step 1 : Now under your app folder
you should see libs
, if you don't see it, then create it .
Step 2 : Drag & Drop the .jar file here
, you may be get a prompt "This file does not belong to the project"
, just click OK
Button .
Step 3 : Now you should see the jar file under libs folder, right click on the jar file and select "Add as library", Click OK for prompt "Create Library"
Step 4 : Now this jar has been added.
That solved my problem. Try, if anyone want more details let me know.
Create a folder libs. Add your .jar file. Right click on it and you will find add jar as dependency. Click on it. Its all you need to do. You can find the dependencies added to your build.gradle file.