1 - In the root directory, create new folder: /libs in which and place your external libraries in there.
2 - Change the project structure
yourprojectname/
app/
- build.gradle // Local Gradle configuration (for app only)
...
libs/
libraryName/
- build.gradle // Local Gradle configuration (for library only)
- build.gradle // Global Gradle configuration (for whole project)
- settings.gradle
- gradle.properties
...
3 - don't forget to change gradle.setting to
include ':app', ':libraryName'
project(':libraryName').projectDir = new File('libs/libraryName')
4-In app/build.gradle add your library
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile project(":PagerSlidingTabStrip")
}
Also there is way in android studio to add your library so it config gradle and project structure and it is :
1.File / Project Structure /
2.In module section find your project and in Dependancy tab add your library