Saturday, May 11, 2013

Fast Android Iteration, Part II

In part I of this series, I wrote about how I've achieved fast iteration on device with Android.  I just realized this morning though, that I forgot a couple things, so here's part II.

Eclipse is a popular tool for developing Android applications, and it even supports native and java on-device debugging. But it didn't work with this fast iteration method, because it does something really annoying: it completely controls the application data folder. Eclipse would rebuild the apk, wipe the data folder, and then reinstall it on each iteration. My "raw" folder would get removed, and so there was no benefit to copying only files that changed. I'd have to wait for the APK to get built and installed every time, which was the typical device iteration problem I always had.

So I'm not using Eclipse. The Android SDK supports ant, so I'm using the command line to build and manage my APK. It's really simple and easy to do. I only have to rebuild the APK when it's time to send a new build with my latest changes to a friend. Otherwise, I'm just running ndk-build and my script to copy changes to "raw". Here's a tutorial for using ant with Android.

The only thing I miss about Eclipse is on-device debugging. I spent a little bit of time trying to get Eclipse's debugging interface working with ndk-gdb, but I didn't get anywhere without using Eclipse for the whole project. After some searching, I found this tutorial on using CGDB to debug Android apps on device. It was really easy to setup.

Of course, CGDB isn't as nice as a graphical interface like Eclipse's. I do most of my debugging on PC (my engine support Linux too), and the Android log and stack traces are usually sufficient to fix problems on device. But when I want to debug something, CGDB gets the job done. The fast iteration time more than makes up for the slower debugging!

No comments:

Post a Comment