65.9K
CodeProject is changing. Read more.
Home

How to add external library file in Android Studio

starIconstarIconstarIconstarIconstarIcon

5.00/5 (7 votes)

Jun 17, 2013

CPOL
viewsIcon

97006

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.

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

History 

For more information check this link: