質問

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.

役に立ちましたか?

解決

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;

他のヒント

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?

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top