Import Library Project or Module as Dependency in Android Studio

July 9, 2020
Android Studio
library project or module as dependency in android studio

How to Import Library Project or Module as Dependency in Android Studio

Objective

The main objective of this post is to help android developers on how to import library project or module as dependency in Android Studio.

Introduction on how to import library project or module as dependency in Android Studio:

Android Studio is a next gen and fully featured IDE for android developer by Google in collaboration with intelliJ. It’s more advance and with better IntelliSense as well as lots of other features. It uses gradle and maven as project management tools so, for eclipse user it would be tough to use it. Due to gradle it becomes more flexible than older ADT.

This blog is written for those users who has knowledge about android app development.

This blog is for who wants to transfer themselves to android studio from eclipse environment. In android, developers need to use external library-project or module for project. But for eclipse user it would be tough to do it in android studio, as well as new project-libraries are being developed in android studio.

So, in this blog how to import library-project /module in android studio and how to use it, is shown in six simple steps.

Step 1 Create New Project in Android Studio

If you are new to Android Studio and don’t know how to create a new project then you should checkout our other blog:

Step 2 Now open file menu and click on import module

import library module in android studio

Step 3 Open Directory

Now click on browse file or use Shift + Enter

source-directory

Step 4 Select Directory Module

Now select your library-project/module location from dialog, Here we are using appcompact_v7 library.

module-location

And now in project tab you can see your imported module

imported-module

Still you can’t use this library/module as dependency for that it must be registered in build.gradle file

Step 5 Register Module

Register module in build.gradle: For that follow these simple seven steps

Open file menu and click on project structure

project-structure

Now in Project Structure dialog box select app under module

app-under-module

Now Click on Dependencies tab in project structure dialog

project-structure-dialog

Click on + sign in right side corner

right-side-corner

Select Module Dependency from list

module-dependency

Select library/module that we have import from dialog box

select-library-module

Click apply and Ok

library-is-registered

Now library/module is registered in build.gradle

Step 6 Finally click on sync gradle button

screenshot-29

Now library-project/module is registered and synced with gradle now you can use it.

Download Here
Facebook Comments

Leave a Reply

Your email address will not be published.