简体   繁体   中英

How to add libraries to an Android project?

I would like to use Apache Commons Lang in my Android project, but I don't know how to do it. Should I use the source or the binary? How to proceed then in Eclipse?

Should I use the source or the binary?

Yes. :-)

In other words, either should be fine. Source has the advantage of allowing you to trim out stuff you don't want and fix any compatibility issues you encounter with Android. OTOH, the JAR is more convenient.

How to proceed then in Eclipse?

If you are using source, just add it to your project.

If you are using the JAR, add it to the libs/ directory of your project, then add it to your build path. Be sure to use the Add JARs button in the Build Path dialog in Eclipse to refer to the JAR that is already in your libs/ directory. Everything else will be taken care of for you.

Personally, I'd go with the binary.

Download the binary (commons-lang3-3.0-beta-bin.zip)

Extract the jar file to somewhere you are familiar with. Usually i'd have all ma java libraries in one folder (commons-lang3-3.0-beta.jar)

Right click on your project in Eclipse -> build path -> add external archives

navigate to the location you saved the extracted the jar and select it..

Viola.. Thats it.. I hope it helps.

Happy Coding..!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM