Android Development

How to add project as a library to Android Studio

How to add project as a library to Android Studio

But if you want to add another project as a library in your application. For that, you need to add that library project to your application as a module dependency.

1. Open Your Project in Android Studio.

2. You will find the two main directory name samples and others.

3. Go to Android Studio and navigate to File -> New -> Import Module -> Select the library path -> Finish.

Go to Android Studio and navigate to File -> New -> Import Module -> Select the library path -> Finish.

4. Import-Module from Directory.

Import-Module from Directory.

5. Then right-click on the App directory -> Open Module Settings -> Dependencies -> Click on + button inside Declared Dependencies -> Module Dependency -> Select your library -> Ok.

Then right-click on the App directory
Then right-click on the App directory

Another way to add Module Dependency

  • Open build.gradle Of the main module
				
					dependencies {

implementation project(":sample")

}
				
			

There can be a situation when we need to modify the library code according to our requirement then in that case we can follow this method.

Share On: