Search code examples
androidandroid-studioandroid-ksoap2

Add a jar file in android studio 0.3.2 version


I am new to android studio and know nothing about it, i want to add the kSoap Jar file into my project, so i read many article on this but could not point my finger to it.

Articles read are :

http://articlesforprogramming.blogspot.in/2013/06/how-to-do-add-external-library-file-in.html

Also i read that there is an issue for adding module in the studio, I have updated my build.gradle file with the following line

dependencies {
compile files('Libraries/ksoap2-android-assembly-3.1.1-jar-with-dependencies.jar')

}

and rebuild my project, but when i try to import the ksoap it gets imported but i cannot make use of the classes present in ksoap like soapobject etc.

One thing i learned is that you need to place your JAR files in a libs folder but when i created a test project i was not able to see the libs folder so i created a new directory and named it libs so am i doing this right?

enter image description here

Could you please guide me out on this.


Solution

  • It is always good to keep your jar libraries in libs directory. Then you can try this method:

    dependencies {
     compile fileTree(dir: 'libs', include: '*.jar')
     compile project('...')
    

    }

    Think also about switching to Android Studio 0.4.0 (which is available right now). More stable and many fixes since 0.3.2 version.