Tuesday, January 15, 2013

Emacs/Vim: Jump to errors for Java and C++ on Android

Any of you guys use vim or emacs to develop Android apps?  I sure do.  No substitute for a good editor.  Only problem is when I am doing NDK code and Java mixed (like so many others who develop games), the editor won't go to the errors in Java code since Ant formats the error output strangely.

Well fear not folks, it is an easy fix.  I usually do all my development in a Makefile that calls ant for the Java stuff and the normal ndk-build for the JNI stuff:

You simply add the -emacs option to your ant command.  I personally bind a function key to :make in vim, and have the ant command as one of the default targets.  It ends up being called like this for debug builds:

ant -emacs  debug

Now, with this addition, Vim and emacs will jump to all your NDK and Java errors for Android development.

It's as easy as that folks!  Happy Viming!