Android Studio | How To Add A Library Project?

Android Studio Add Library

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:

  1. Goto File -> New -> Import Module.
    Android Studio Add Library
  2. Source Directory -> Browse the project path.
  3. Specify the Module Name – it is used for internal project reference.
    Android Studio Add Library - 2
  4. Let Android Studio build the project.
  5. Open build.gradle (Module:app) file.
  6. Add the following line with your module name in place of “Volley” in the dependencies block:
    compile project(':Volley')
  7. It should look something like this:
    Android Studio Add Library 3
  8. After this Android Studio would start saying “gradle files have changed since last project sync”, press the “sync now” link to start a sync.
  9. 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.

About Mohit Gupt

An android enthusiast, and an iPhone user with a keen interest in development of innovative applications.

Leave a comment

Your email address will not be published.

7 thoughts on “Android Studio | How To Add A Library Project?