04 February, 2011

Android SDK Upgrade

Well, I've been lagging behind the Android SDK primarily because I didn't want to interrupt my completing my first Android app. I unsuccessfuly attempted to update from v7 to v8 but found that v8 didn't work for Debian at the time and I didn't want to spend the effort resolving.

Fast-forward to today, I updated to v9 and attempted to build my application developed with v7 and immediately was faced with the following error while attempting a build;

user@River:~/AndroidDev/SpinTheBottle$ make clean
ant clean
Buildfile: /home/user/AndroidDev/SpinTheBottle/build.xml

/home/user/AndroidDev/SpinTheBottle/build.xml:46: taskdef class com.android.ant.SetupTask cannot be found
using the classloader AntClassLoader[]

Total time: 0 seconds
make: *** [clean] Error 1

Google advised me that I only needed to update my project by executing the following command;

$ android update project --path ~/AndroidDev/SpinTheBottle

Re-building was then successful.


Simulating Mouse Events

I've been struggling to find a suitable testing method to test the Android applications I'm developing. As I'm relatively new to testing UI's I didn't have much to fall back on.

I first began looking at LDTP, but found that the raw mouse events were limited to click and double-clicking left and right buttons. I needed something more flexible to support swiping the Android Emulator.

What I found was 'xdotool' which seems to hit all the marks; activating a window, depressing either mouse button, moving the mouse, and releasing the button(s). Introducting a delay between mouse down and up allows for long press events.


$ xdotool windowactivate `exec xdotool search --title 5554:myAvd`
$ xdotool mouse move 100 100
$ xdotool mousedown 1
$ xdotool mouse move 200 200
$ xdotool mouseup 1