14

Hay, how do i import org.apache.commons packages into android so i can use them in my applications?

Thanks

1
  • See this related question if you run into NoSuchMethodError at runtime. Commented Nov 2, 2014 at 6:33

4 Answers 4

14

If you're using eclipse:

  1. Download jar packages for libraries you are interested in
  2. Go to project properties in eclipse -> Java Build Path -> Libraries. Add External JARs here.
Sign up to request clarification or add additional context in comments.

2 Comments

On OS X using Eclipse i don't have an "eclipse" menu item. any ideas?
Scrap that, i found it. Life saver, thank you very much Nikola.
5

Just for completeness' sake - if you aren't using eclipse to develop and you are building with ant - just put the jar in your libs folder of your project.
Done!

Comments

3

Also, be warned that not all of them can be automatically converted to Dalvik. For example commons-httpclient does not convert cleanly from the release binaries, you need to go through source to make it work.

Comments

0

If you are using android Stuido - that doesn't yet supports adding libraries - you need to edit the src/build.gradle

I wanted to add org.apache.commons.net and My file called 'org.apache.commons.net.jar' was placed in the libs folder, so my build.gradles dependencies look now like this:

dependencies { compile files('libs/android-support-v4.jar') compile files('libs/org.apache.commons.net.jar') } 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.