Reputation: 133
First, this is not duplicate. I have browsed answers to "How to add library to project in Android Studio" but found no answer. I cant find src
and libs
folder. I want to add volley jar to project. Screenshot attached:
https://i.sstatic.net/2SyUp.png
Upvotes: 1
Views: 3958
Reputation: 782
For preferred way read bellow this answer:
If you need to add a library to the Android Studio project navigate to your project folder with default path at: \YourProjectName\app\libs
You can paste your *.jar library there. Make sure your build.gradle contain this directive at dependencies part:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
To see the library at the Android Studio, switch to the "Project" view at the menu:
Preffered way:
Preferred way to import libraries to your project is by gradle dependency system. To do so, open your build.gradle file and locate the dependencies part. To import the library you mentioned, Volley, your dependencies part should look somehow like this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.mcxiaoke.volley:library:1.0.10'
}
You don't need to import the *.jar library manually any more. Gradle dependencies system will take care of it.
To find gradle dependency you need, you might use tools like:
http://gradleplease.appspot.com/
Upvotes: 2