Android Studio | How To Add A Library Project?

The new kid around the block is Android Studio. Its the new official IDE for Android development. Its a IntelliJ IDEA based IDE. Its a very flexible sort of an IDE, like most of the other java IDE’s. But since its a new development environment most of us don’t know how to do the most basic things in Android Studio. For example how to add a library in your project. As till now we have been working on Eclipse IDE.

How to import a library project in Android Studio?

In this short tutorial I would show you how to import a library project in Android Studio v1.2.1.1. The steps to do so are:

Goto File -> New -> Import Module.

Source Directory -> Browse the project path.

Specify the Module Name – it is used for internal project reference.

Let Android Studio build the project.

Open build.gradle (Module:app) file.

Add the following line with your module name in place of “Volley” in the dependencies block:

1

compile project(':Volley')

It should look something like this:

After this Android Studio would start saying “gradle files have changed since last project sync”, press the “sync now” link to start a sync.

That’s all you need to do.

This is how you add a library project to an Android app project in Android Studio. Now that you have learned how to add a library to your android app, Happy Coding. Don’t forget to like our Facebook and Google+ page for more updates like these.