I am building a library for use in Android apps. So far I have been using a library project in Eclipse to make a jar file. That works fine, but I'd like to build the jar from source using a command-line invocation of some sort. Yesterday I tried doing something along the lines of:
javac -d bin/classes -classpath\
my-android-sdk/platforms/android-19/android.jar\
com/mycompany/mystuff.java ...
jar cf mystuff.jar -C bin/classes com
This generates a jar alright, but I've had no luck using that jar in an Android Eclipse project. I get runtime errors of the form "unable to resolve static method...".
Should this work? Is there a better way to build an android-project-compatable jar at the command-line?
Thanks in advanced.
Edit: Following the advice of CommonsWare, I found I can build the jar by replacing javac above with ant. First I use Eclipse to export a build.xml file (https://stackoverflow.com/a/4186557) then I appeal to ant at the command-line to generate bin/classes. Then I build the jar from the command-line like before. I still don't know why javac doesn't produce the same thing, but this is good enough for me.