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:
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.
Born in New Delhi, India. A software engineer by profession, an android enthusiast and an evangelist. My motive here is to create a group of skilled developers, who can develop something new and good. Reason being programming is my passion, and also it feels good to make a device do something you want. In a very short span of time professionally I have worked with many tech firms. As of now too, I am employed as a senior engineer in a leading tech company. In total I may have worked on more than 20 projects professionally, and whenever I get spare time I share my thoughts here at Truiton.
Thanks for the tutorial.
However, importing a module only explains how to import the lib project into a given project, meaning that the imported files will reside under the project’s folder structure.
How would you import the lib project as an independent project that could be shared among other projects?
Same question for me. Why to make a library if you cannot share it between multiple apps ? I’m starting to believe that it is not possible to do that with Android studio.
It works. Thank you, Mohit.
yeah, it’s really nice.
Thank you sir for nice and short tutorial… this is best tutorial regarding import any module in Android Studio… 🙂
I Want to make my app in location news feed system for mobile users i want use modules in it im comfuse to how to make modules plz suggest me
thanks so match