Ubuntu and Android, sitting in a tree (nearly)

Today I helped Bruce be able to screencast his Android phone, so that he could easily do a presentation showing something on his phone. That is: plug the phone into his laptop, and show, on the laptop’s screen, what’s on the phone’s screen.

An app exists for this: androidscreencast. The tl;dr summary of this whole thing is: use androidscreencast, it’s cool. The rest of this is really about Ubuntu.

Here is how this installation process should have worked for Bruce on his Ubuntu machine, in an ideal world.

  1. Click the link on the androidscreencast page saying “Install the Android SDK”, which would have asked for his password and then immediately installed that SDK on Ubuntu, no further interaction required.
  2. Click on the “Click HERE” link on the androidscreencast page, which would have immediately launched the androidscreencast application and shown his phone’s screen on his laptop.

It wasn’t quite that smooth. However, pretty much all of the reasons that it wasn’t that smooth are fixable. I’ve tried to find bugs for all of these; specifically, I suspect that what these bugs need is someone to think, “I want Ubuntu to be a brilliant environment for developing Android applications”, and so take them in hand. Maybe that’s you?

So…

Clicking the link on the androidscreencast page saying “Install the Android SDK” and having that immediately start installing it would require the following:

  1. That link should be to apt.ubuntu.com, referencing an Android SDK package. This would be fairly easy to convince the androidscreencast team to do, if the rest of this list existed, I think, and failing that the Android SDK site itself could and should point at the Ubuntu package for Ubuntu users.
  2. The Android SDK would need packaging for Ubuntu. Someone seems to have filed an ITP for the Android SDK in Debian (Debian bug 459219, but that was in 2008 and I don’t think anyone’s picked it up since.)
  3. Since the Android SDK isn’t likely to end up in the main section of the Ubuntu archive (although: could it? I don’t want to get into lawyerly discussions, but it seems to be open source, no?), it’d need to be in the Canonical partner repository.
  4. The Canonical partner repository does not seem to be enabled by default, at least on Bruce’s Ubuntu 10.10 machine, and it should be so enabled. (This seems to be Ubuntu bug 635003, although I’m a bit confused by that bug.)
  5. The Android SDK applications won’t work as a normal user, because you need to add a special udev rule to give the user permission. This is Ubuntu bug 316215 and is fixed in the upcoming Ubuntu 11.04, hooray!

With all those things done, clicking a link on the androidscreencast website would pop up an “enter your password” dialog and then install the Android SDK. Excellent.

Clicking the “Click HERE” link should launch the androidscreencast application.

That link is a Java Web Start link. Java Web Start is a fairly neat Java thing; you click on a simple link in a web page, that link leads to a file describing a Java application, your computer gets that file and then uses the description to download and run the Java application itself. To make this work in Ubuntu:

  1. Clicking a Java Web Start (jnlp) link should do something when you don’t have Java installed. This is much like the idea that when you first hit a Flash-using website in Ubuntu, you get the “plugin finder” window which leads you through installing Flash. It ought to be possible to write a very tiny .jnlp handler which informs the user that they’ve tried to run a Java Web Start application and helps them install Java, and ship that handler by default. (Note: I’m sure there are plenty of people who will now say: why is Java so special? If we do that, then why don’t we ship something to handle AutoCAD files by default and offer to install DraftSight, or handle PPT files by default and offer to install LibreOffice Impress. Well: why don’t we? Sounds like a good idea to me. I mean, running a command in the terminal will offer to install the package it’s in. Why not help normal users as well as terminal users? According to Ubuntu Brainstorm suggestion 2347 and its duplicates, this already exists in Ubuntu (which is weird because I’ve never, ever seen it) but if it does then we should add jnlp files to it. It seems to have existed in gnome-app-install, which no longer exists; does Software Centre do this? It seems not.)
  2. Java is not installed by default (which is fine), and it’s already in the Canonical partner repository. However, the partner repository is not installed by default (as above).
  3. If a user wants to install Java, and they know enough technically to know that what they want is to install Java, then they might take the approach of searching for “java” in the Ubuntu Software Centre. However, that brings up “OpenJDK Java 6 Runtime” as the top hit, then something named “IcedTea”, and the actual “Sun” official Java nowhere. (To find the real Java, you have to look in the “technical items”, and then know that you want the Java from Sun (who are now Oracle anyway!), and then find packages named sun-java-something. Even I barely know how to do this.) I mean, I’m all in favour of suggesting that people try the open-source flavours of Java, but in my experience they hardly ever work for existing Java apps that weren’t written with them in mind; we’re currently promoting them not only over the real “Sun” Java, but exclusively instead of the real Java. This will not make people wanting to use Java apps very happy. (If you’re about to write a comment saying that OpenJDK is the real Java and I’m wrong: try and resist it.)

Fixing those few things would make Java Web Start applications work really neatly on Ubuntu, which would be pretty cool. It would also make Android screencasting work really neatly on Ubuntu, which would also be pretty cool. Good work to the androidscreencast people: once all the jigsaw pieces were in place, your app Just Worked, and the jigsaw being so complex isn’t your fault.

So… sorry, Bruce: as you note, what I had to do was terminal magic followed by editing some weird java xml shit. I would have liked to not have to do it, especially since if I hadn’t been through all this before for myself it would have taken hours rather than minutes. I’ll cross my fingers that someone would like to make Ubuntu the best platform to build phone apps for Android on.

More in the discussion (powered by webmentions)

  • (no mentions, yet.)