How to make an Android app using the latest Processing Beta

Nikolaus Gradwohl2010-03-22T05:59:00+01:00

The Processing-Team has released a new Beta a view days ago, this version has some awsome new features including starting support for Android Applications. This is a very short howto that shows how to get a first simple sketch running in the android emulator.

emulator running processing sketch

First you need the most current processing beta from here (0181 at the time of writing) and the android sdk from here.

unzip both files to a directory you like. Then go to the android-sdk/tools folder and start the android sdk manager (on linux for example by typing ./android in the shell)

then go to "Available Packages" on the left and install the Google APIs version 5 rev 1 and the corresponding sdks (its marked as obsolete so you have to check the little checkbox on the bottom)

then set a shell variable that points to the location of your android sdk

export ANDROID_SDK=/wherever/your/sdk/is

now start the processing beta and make a short sketch like this little bouncing ball

PVector pos;
PVector v;
void setup() {
  size(320,480,A2D);
  smooth();
  pos = new PVector( width/2, height/2);
  v = new PVector( 10, 10 );
}

void draw() {
  background(255);
  ellipse( pos.x, pos.y, 30,30);
  pos.add( v );
  if (pos.x < 0 || pos.x > width) v.set( v.x * -1, v.y,0 );
  if (pos.y < 0 || pos.y > height) v.set( v.x, v.y*-1,0 );
}

Switch to the android mode by selecting "Android Mode" from the tools menu

android mode

Now hit the play button Processing will start the android emulator and start your new sketch (this will take some time)

emulator running processing sketch

The android support is still a bit shaky and i haven't tried the apps on a real phone yet - but it's really prommissing and i really like the idea of running processing sketches on my phone :-)

Tweet This! submit to reddit Digg!   Tags: | 5 comments | no trackbacks

See also:

Android Monome-Clone in Processing
Processing and Blender Sound Visualizer for Magical Dreams
flowershape
cuircuitboard noise pattern
particles in the wind

Trackbacks

Comments

Leave a response

  1. simpleex 2010-03-23T09:25:30+01:00

    Thx for this tutorial !

    I followed it and have a bad "Error running javac.exe compiler"... Any clue ?

  2. Nikolaus Gradwohl 2010-03-23T13:34:55+01:00

    I didn't test it under windows, but this message sounds like ant is unable to find your javac compiler. is javac.exe in your system path?

  3. Jonathan Feinberg 2010-03-23T13:55:56+01:00

    Actually, things work even better on the real phone. If yo have a choice, ditch the emulator, and always run the sketch in "Presentation" mode.

  4. simpleex 2010-03-23T15:07:32+01:00

    Thx ! I reinstalled JDK, the app launches but I got Android errors in the emulator (Force to close app). I will try the Presentation mode instead..

  5. Furkan 2010-04-01T15:49:04+02:00

    I did everything properly but it stills gives an error...

    Creating full resource package... Creating sketch_apr01a-debug-unaligned.apk and signing it with a debug key... Using keystore: C:\Documents and Settings\PhD_OpenGL.android\debug.keystore

    Something wrong with keystore..I don't know what to do..Please help me...

Leave a comment