Arggh! Failed Android install

By | October 22, 2015

You just spent 10 mins waiting for Titanium to build your app for Android and install your app. At the end of it all, you get a message like the following in the console:

[INFO]  Making sure the adb server is running
[INFO]  Installing apk: /path/to/your_app/build/android/bin/YourApp.apk
[INFO]  Installing app on device: Galaxy Nexus
[ERROR] Failed to install apk on "01498FE710016018"
[ERROR] Error: INSTALL_FAILED_VERSION_DOWNGRADE

There are all sorts of reasons that an install will fail (in the case shown here, a newer version of the same app is already installed on the device…in development, it happens). You could fix the problem then wait for Titanium to rebuild your app again. Or, turn to adb to install the version that’s already compiled. The console log even helps you out giving you the path to that APK file.

~ adb install -r /path/to/your_app/build/android/bin/YourApp.apk
4134 KB/s (26912556 bytes in 6.355s)
    pkg: /data/local/tmp/YourApp.apk
Success

(The -r flag says to reinstall the app, and is not really necessary here. But it doesn’t hurt so I usually throw it in there.)

The adb command is included with the rest of your Android tools. It’s handy for all sorts of things: accessing device logs, transferring files, and even installing apps as shown above. Check the adb docs for more info.