Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Mobile / Android

How to add external library file in Android Studio

5.00/5 (7 votes)
17 Jun 2013CPOL 97K  
This article will give you a good idea about adding external jar files in Android Studio.

Introduction

Here I am going to give a sample example of how to add the ksoap2 jar library in Android Studio. Adding external library in Eclipse is different with Android Studio. You can download the ksoap2.jar file from:

Using the code 

For adding the ksoap2 file we have put that file in the libs folder, project->libs.Open the libs folder in Explorer and paste the ksoap2 jar file in it. Come to studio and refresh the project. We will see the ksoap file in the libs folder. Now right click the ksoap file and select the Add as library option. Then a new create library window will open. Click on OK. Now we can use this jar file for our application. Also add  the below code in the build.gradle file and rebuild the application.

Java
dependencies{ compile files('libs/ksoap2-android-assembly-2.4-jar-with-dependencies.jar') }

Image 1

History 

For more information check this link: 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)