How to add jar/library files as a dependency in Android studio gradle file

This example will show how to add jar/library files as a dependency in the Android studio.

Every Android application has two Gradle files

  • Module level Gradle file
  • Project level Gradle file

To each module dependency, we will find inside the Module level Gradle file.

So now we need to add Jar file inside lib folder as a dependency in Gradle file.

Let's get started

Step 1: Create an Android studio project

Step 2: Add your jar file to the lib folder

 

Add jar file in android studio as dependency

 

 

Step 3: Now right click on the jar file and select Add as Library

 

Add jar file as dependency in Android studio

 

Step 4: Open build.grdle file and sync project.

 

Now you can use your jar files as a dependency.