Problems installing and/or launching Android apps (2)

Further to my previous post on common problems installing and/or launching Android apps, here’s a little titbit to add into the mix.

In that previous post I mentioned:

Sometimes a small change in the application, like updating the package name or altering the signing process (i.e. changing the package’s signature), will mean an application can’t be re-installed over a previous version.

Just to add more detail, I realised there is a classic case of this type of issue. In building up either Android samples or proper applications in Oxygene for Java, I often copy the project between machines, switching between a couple of laptops and a VM on a desktop machine. In the case of simple projects this machine switch is either done using a shared network drive or using my DropBox folder.

The point is that as soon as I switch to another machine and start building a regular Android application I can no longer install it from the development environment. This is because Oxygene wants to re-install the application (so that any app data, such as SQLite databases) are preserved between increments of the application. That’s nice of Oxygene, but it’s hitting an issue with this goal.

Here’s the problem. As I mentioned in another article, without a dedicated certificate, the Android SDK tools invoked by Oxygene will use the default Android debug key to sign the application. The Android debug key is created on a given machine the first time the SDK tools are used to build an application. From machine to machine each Android debug key will be different, so when you go to re-install the same application compiled on a different machine Android will notice the inconsistencies in debug certificates and reject the re-installation attempt.

You have no choice but to drop to the command-line and use adb to uninstall the application. After this, the application should install and run just fine.

Of course you get the same problem when using a dedicated certificate and you re-create it for whatever reason, or if on a given machine the Android debug certificate expires and gets recreated by the SDK tools (this happens every year, as the debug certificate is created with a validity period of 365 days).