Android Studio 1.0.1 add external libraries

Wasif Khalil picture Wasif Khalil · Dec 18, 2014 · Viewed 37.8k times · Source

I have just downloaded Android Studio 1.0.1 and this is the new project structure

enter image description here

and when i see it in the explorer there is a empty libs folder enter image description here

i want to import 3 external libraries i have, which i want to use.

build.gradle has already defined this

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}

but when i copy my libraries in libs folder my project still dont recognize it, how do i make use of the libs folder and copy my libraries in this folders and use it? any help?

Edit: it was a simple question, how to add libraries to project in Android Studio like we do in eclipse, for eg i have a library project(a folder, not a jar!). in my case i have a library project 'viewPagerIndicator' (again a Library folder, not a jar!) i have to add it to my project like i use to do it with eclipse by importing project, right click->properties->android->Library->add-> select the library project

PS: i have found the answer now. suppose my library project name is 'viewPagerIndicator' - Copy library project on root of my Android Studio Project - Under build.gradle(under your Android Studio Project folder) write this under dependencies compile project(':viewPagerIndicator') - include it in settings.gradle, write: include ':viewPagerIndicator' - Sync project with gradle files

this is how project structure look like now:

enter image description here

so sorry that admins stopping the question without understanding it.

Answer

Paritosh picture Paritosh · Dec 18, 2014

First you have to add library project (module) in Android Studio

File -> Import Module

To add library project (module) in build path, click

File -> Project Structure

On the left hand side click on

app -> Dependencies tab -> green + button -> Module dependency

Now select the library project you already added.

For more details refer this link