Click here to Skip to main content
15,886,067 members
Articles / Mobile Apps / Android
Tip/Trick

How to add external library file in Android Studio

Rate me:
Please Sign up or sign in to vote.
5.00/5 (7 votes)
17 Jun 2013CPOL 96.2K   11   2
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)


Written By
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 5 Pin
_Vitor Garcia_18-Jun-13 6:19
_Vitor Garcia_18-Jun-13 6:19 
nice to know the difference. ty
GeneralRe: My vote of 5 Pin
josh-jw19-Jun-13 17:47
josh-jw19-Jun-13 17:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.