Python for Android
Linux Journal published interesting article in March issue, #204, titled “Python for Android”.
I’m happy to report that installing SL4A and python for Android on my HTC Hero (running Android 2.1) as described in the above article was trivial.
Here are the steps on how to install SL4A and Python for Android on HTC Hero (with OS 2.1):
- Temporary enable installation of applications from unknown sources
Menu -> Settings -> Applications -> check "Unknown sources"
- open Android web browser on your HTC phone and go to http://code.google.com/p/android-scripting/.
If you tap on “QR Code” on the web page you’ll start downloading SL4A, at the time of this writing it was sl4a_r3.apk.
After download completes, simply tap the downloaded apk package, then tap on Install button. This will install SL4A on your phone. Test the installation by tapping on Open button to open SL4A. If you receive warning “No matches found” simply ignore it, because you don’t have any script yet.
Now, that we have SL4A “engine” ready, it’s time to install Python itself.
- return to Android web browser and open the page http://code.google.com/p/android-scripting/. Find “Featured Downloads” section on left side of the page, then find the package PythonForAndroid_r4.apk. Tap the package to initiate the download, when download completes tap the package to start installation by tapping “Install button”.
When installation completes tap the “Open button” followed by tap on Install button. This will download and install python support libraries from SL4A web site and add them to SL4A.
- That’s it. If you check your Applications you’ll see two new icons, “Python for Android” and “SL4A”. At the time of this writing, python version was 2.6.2.
- If you open SL4A you should see some pre-created python demo scripts on the list.
- If you tap on the particular script you can pick action from the menu.
- For example, you can Edit the script.
- Finally, don’t forget to disable option that allows installing applications from unknown sources (see point #1).