Back to article
Android Scripting With Python
Installation and Hello World
August 19, 2010
One of the things about the Android platform that appeals to many in the Linux community is the fact that it's based extensively on open source, Oracle lawsuits notwithstanding. The primary way to write applications for an Android-based phone is still Java. Google provides a Software Development Kit (SDK) with all the documentation, libraries and tools you need. There's even an add-on for the open-source Eclipse Integrated Development Environment (IDE) to help you along.
The first thing you need to do is download the appropriate SDK for your phone. We used the HTC Evo 4G running the latest version of Android code named Froyo. You can get started with scripting your phone by downloading the SLA4 application using either the Android Market on your phone or by scanning the QR code on the SLA4 website. Once installed you'll have a new icon labeled SLA4 on your application launch screen.
Touching the SLA4 icon launches the scripting host which initially has only the Shell interpreter installed. You can download other interpreters from the SLA4 homepage. If you happen to have the very cool Firefox add-on to send stuff straight to your phone and the Chrome to Phone app on your phone, you're literally just one click away from sending it to your phone. For our testing purposes, we downloaded the Python interpreter, which puts a 2.6.2 version of the Python language on your phone.
If you really want to get serious about writing and debugging code, you'll need to install the Android SDK. You'll find versions for Linux, Mac OS X and Windows on the Android SDK download page. For Linux, you basically unpack the tgz file and set an environment variable to add the SDK/tools directory to your search path. You'll also need either version 5 or 6 of the Java Development Kit (JDK). They have a page of notes for installing on Ubuntu to help get you up and running. Once that's done, you should be good to go to connect up your phone and start hacking away!