Android with processing

The Buzz word in the mobile phone industry has been Android. Android is showing a promising future to both the open source world and the mobile computing. Just like the growth of Internet the users of androids have also rised exponentially. And so has the demand for android app development. Android ap development seems a thing for the geeks and hackers, tutorials on android app development with eclipse can become frustrating at times. But as always it is with the open source world there is always an alternative way that works just out of the box.

Android is a Linux-based operating system for mobile devices such as smartphones and tablet computers. It is developed by the Open Handset Alliance, led by Google, and other companies.

Google purchased the initial developer of the software, Android Inc., in 2005. The unveiling of the Android distribution in 2007 was announced with the founding of the Open Handset Alliance, a consortium of 86 hardware, software, and telecommunication companies devoted to advancing open standards for mobile devices. Google releases the Android code as open-source, under the Apache License. The Android Open Source Project (AOSP) is tasked with the maintenance and further development of Android.

About Processing

Processing is an open source programming language and integrated development environment (IDE) built for the electronic arts and visual design communities with the purpose of teaching the basics of computer programming in a visual context, and to serve as the foundation for electronic sketchbooks. The project was initiated in 2001 by Casey Reas and Benjamin Fry. It brings complex graphics programming down to earth for the common man.

Before starting this tutorial I would like the readers to get acquainted with processing and its code, which is Java and learn to write basic programs with processing.

So teaming up processing and android can gear up things in the open source world. In this tutorial I will give an introduction on how to develop android apps using processing and how to package them as apk files. The technique given below has been tested b myself and is working.


  • We need the most recent version of Processing and you wont find it in the processing .org site as on May 9, 2012 the version available in this site is 1.5.

So we have to download version 2.05a from

  • Once you have processing downloaded extract it to any folder of your choice.
  • Download the android sdk from: once it’s finished again extract it where ever you like.
  • Go into the extracted android-SDK folder, into the tools subfolder and run “android”. In linux just open terminal and cd to that folder an type ./android
  • Through the gui that launches, update and install all available packages.
  • The main packages is the Android SDK Platform-tools
  • Android 2.3.3 (API 10) ->SDK Platform
  • Android 2.3.3 (API 10) ->Google API
  • Windows Users need the Google USB Drivers too.

Once this is over your system is ready to develop android apps


  • Start processing and on the top right corner there is a box written standard click on it and change to android.






















  • Now write down the code most of the code in processing can be used in android but there are certain exceptions like there is no rollover in android as it is absurd .
  • I will give a small code example. Here we are making an app to draw using our finger on the smartphone screen.
void setup()
void draw()
  • Press the play button on the top left of the processing window and wait till the emulator is loaded with the app.
Our First Program








  • Once you have tested your sketch and is satisfie it is time to distribute tit to the worl and for that we have to package it

Wrapping it Up

  • From the file Menu oin processing select “Export Android Project”. A folder called android is created in your sketch folder.
  • Open the terminal and cd to this folder
$ cd /home/kartha/sketchbook/draw/android

•Then generate a private-public keypair

$ keytool -genkey -v -keystore <keyfile.keystore> -alias <alias> -keyalg RSA -keysize 2048 -validity 10000

This command is nothing but generating a key and calling it draw.keystore it has a validity of 10000 days.

Answer all the questions followed and remember those answers.

  • Next build the apk

$ ant release

This command will generate a file called sketchname-release-unsigned.apk in the bin folder

  • Sign the app

$ jarsigner -verbose -keystore <Keyfile.keystore> bin/draw-release-unsigned.apk <alias>

  • Finally generate the apk file

$ zipalign -v 4 bin/sketchname-release-unsigned.apk  name.apk

Now you have your Android app ready to be distributed to the world. In case you want your own Icons. Create icon-36.png, icon-48.png and icon-72.png . These should be 36×36, 48×48, and 72×72 pixel icons. Place them in the sketch folder (not the data folder or any other subfolder). And rebuild the app.

For more information refer to

This is how we step into the world of android. I have made a Tic tac toe game The source code and the apk can be downloaded from the downloads section.

Tic Tac Toe
Tic Tac Toe


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s