I\'m trying to build an Android project that has some dependencies. The jar files are in the lib/ directory. I can build the project by adding those jar file to my classpa
At compiling do this:
javac -encoding ascii -target 1.5 -d bin/classes \
-bootclasspath $SDKDIR/android.jar src/some/project/* -classpath=libs/*.jar
And, when you are generating the bytecode for Dalvik:
dx --dex --output=bin/classes.dex bin/classes libs/*.jar
Also, when you are packaging the APK file:
apkbuilder bin/something.apk -z bin/projectname.ap_ \
-f bin/classes.dex -rf src -rj libs
I'm assuming you are using Linux... on Windows will be almost the same.
If you store your libraries in ${basedir}/libs the ant script will be able to find them.
I looked at the current ant script ( ${sdk.dir}/tools/ant/build.xml ) and it defines jar.libs.dir to "libs".
FYI, the ant script is well documentated so it's easily to trace through.
If you move libs around be sure to edit your .classpath files to prevent eclipse users from suffering needlessly.
external.libs.dir=lib
after 2 hours of searching for this answer, this worked for me. The jar file in my libs directory finally compiles AND is bundled with the APK.