Linux android command-line build (ant? make?)

Followed the directions and I can successfully build and test on my Android device from within Eclipse. So happy.

Is there a way to build from a CLI? I’m on Ubuntu 12.04. I’ve naively tried “ant debug” and “make.” I am completely clueless when it comes to Java build tools.

Make says “this package doesn’t support your platform.”
And “ant build” fails with some incomprehensible error about unspecified scripts failing.
Barking up the wrong tree for sure.

bumping this

I too was wondering how to do this. I ended up having to do a few things to get this to work.

There is a file called paths.make located here:

/of_v0.9.0_android_release/libs/openFrameworksCompiled/project/android/paths.make

Update the line where is says NDK_ROOT= to point to your NDK root. Pretty self explanatory.

Then, you’ll need to run make with a PLATFORM_OS variable of Android:

make PLATFORM_OS=Android

This will compile the c/c++ code to a shared object file and will also create a jni folder with Android.mk and Application.mk.

After that, I actually had to move the src folder to a temporary location and rename srcJava to src. I thought I could pass in a variable to ant to change where the java sources were found, but due to library dependencies this ended up not working, which resulted in me just renaming the folder.

Now you’ll need to run android update project -p . so your sdk.dir is passed in properly. You’ll also have to do this for any project dependencies. In my case I also had to run it in /of_v0.9.0_android_release/addons/ofxAndroid/ofAndroidLib, replacing project in the command line with lib-project.

After you have updated the project(s), you can run ant debug. This will spit out an apt in the bin directory.

I’m sure there is an easier way to do this, but in my 30 minutes to toying around, this is what I came up with.