Search code examples
androidandroid-build

How to add external libraries to my application in android


I have an application that I have to look at as a training exercise. It has used few external libraries such as SlidingMenu, ImageViewZoom and ActionbarSherlock.

I have downloaded and extracted those libraries but I have no idea how to add them to my existing project.


Solution

  • The Right Way:

    What you need to do is to copy the external library (JAR file) to the /libs folder of your project.

    That way those libraries will compile with your project and could be use on real device when you deploy your application.

    Some times you will need to add a project to your workspace ( For example the Google Map library) and then add the library reference using the properites -> Android window at the bottom.

    You can get an idea of how it's done by reading the first 3 step of this Google Map API V2 guide I wrote. there I reference the android library project:

    Google Map API V2 Guide

    The Wrong Way:

    any other way, like for example adding the files using the properties - > Java build path screen may result in a missing library when you run the project on a real device.