Recently I got my invite to try out the beta of Google App Inventor for Android, a simplified environment to enable people to create applications for Android based phones using visual building blocks instead of a programming language. Google have written extensive set up instructions to get your computer and phone set up: http://appinventor.googlelabs.com/learn/setup/index.html but also on this page is a bit of text that could cause us trouble: "If you are using GNU/Linux, then you should use Sun Java rather than OpenJDK. App Inventor does not work well with OpenJDK." Unfortunately OpenJDK is the default for Ubuntu 10.04 and it might not be obvious how to get the Sun version, so I thought I'd better document what I did to get it working.
I installed the App Inventor Extras software and followed the other instructions on http://appinventor.googlelabs.com/learn/setup/setuplinux.html. The App Inventor system is mainly browser based but also uses Java Web Start, and it is this that caused the problems. It simply did not like the version supplied by OpenJDK, so it was necessary to obtain the Sun version. In older versions of Ubuntu this was readily available, but in 10.04 it was moved to the Canonical Partner Repository, which may not be enabled on some systems. You can enable this repository by doing the following:
- Go to System -> Administration -> Synaptic Package Manager
- Go to Settings -> Repositories -> Other Software
- Tick the entry that says "http://archive.canonical.com/ubuntu lucid partner"
- Close the dialogue box
- Reload the information from the repositories
Now you can install the sun-java-jre package in Synatic (if you don't know how to do this see: https://help.ubuntu.com/community/SynapticHowto).
I have found that OpenJDK seems to work for most things so I decided to leave my system's configuration alone and keep using it. You can easily get Google App Inventor to use the Sun version of the Java Web Start program though. When you are in App Inventor and click "Open the Blocks Editor" you wil be asked if you wish to open it with "OpenJDK Java 6 Webstart". This is not what we want to do so select "Other" from the drop down list and a file dialogue box will open. Click on the pencil icon in the top left and enter this into the Location field: /usr/lib/jvm/java-6-sun/jre/bin/javaws. You should see the orange Java Logo while the program downloads then everything should work and hopefully the Blocks Editor won't hang. You only have to set this up once, when you reopen the Blocks Editor in future "javaws" should be there already as a menu option.
Everything seems to now work and I have successfully gone through a tutorial and experimented around with the App Inventor. It has been quite good fun! If you don't have an Android phone to try out your apps on there is an emulator included in the App Inventor Extras package. Under /usr/google/appinventor-extras/commands-for-Appinventor you should find a script called run-emulator double click on this and in a few minutes you will have an emulation of an Android device that can be used with the software.