1

I'd like to try org.apache.commons.lang.StringUtils in my Android project. I have downloaded commons-lang3-3.1.jar and placed it in my project's libs directory. However importing it fails with the library not being found. I have used many variations of

import org.apache.commons.lang.StringUtils;

with no success. My environment is the linux console and I'm using ant to compile, no Eclipse. My understanding is that Ant picks up any library in the project libs directory.

Please help. Android/java coding noob.

Jocala
  • 243
  • 1
  • 4
  • 16

2 Answers2

1

Lang 3.0 (and subsequent versions) use a different package (org.apache.commons.lang3) than the previous versions (org.apache.commons.lang), allowing it to be used at the same time as an earlier version. ref: http://commons.apache.org/lang/

import org.apache.commons.lang3.StringUtils;
HandlerExploit
  • 8,131
  • 4
  • 31
  • 50
0

Just put the jars in the libs/ directory. Silly me, I was putting them in the lib/ directory until I ran into the same issue and found the answer here: How to build an android app with external libraries using ant?

Community
  • 1
  • 1
Yusuf X
  • 14,513
  • 5
  • 35
  • 47
  • I **am** putting commons-lang3-3.1.jar in my project's libs dir. My problem is that import org.apache.commons.lang.StringUtils; fails each and every time! – Jocala May 15 '12 at 18:40
  • package org.apache.commons.lang does not exist [javac] import org.apache.commons.lang.StringUtils; – Jocala May 15 '12 at 18:45