Ionic-cli: Android error: INSTALL_FAILED_VERSION_DOWNGRADE

Created on 2 Mar 2015  路  6Comments  路  Source: ionic-team/ionic-cli

If you have a version of an app on the device already, and there is a difference in the versions, ant/android gives a pretty cryptic error.

Installing app on device...

/Users/mhartington/GithubRepos/ionic/tmp/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
ERROR: Failed to launch application on device: ERROR: Failed to install apk to device:  pkg: /data/local/tmp/CordovaApp-debug.apk
Failure [INSTALL_FAILED_VERSION_DOWNGRADE]

ERROR running one or more of the platforms: Error: /Users/mhartington/GithubRepos/ionic/tmp/platforms/android/cordova/run: Command failed with exit code 8
You may not have the required environment or OS to run this project

We should try to catch this error and provide a better message for why it failed.

Most helpful comment

It looks like this issue comes from having a previously installed version, according to this issue on stack overflow

The answer seems to be running adb uninstall com.package.name - we should have ionic run this just incase the error pops ups.

All 6 comments

It looks like this issue comes from having a previously installed version, according to this issue on stack overflow

The answer seems to be running adb uninstall com.package.name - we should have ionic run this just incase the error pops ups.

Confirmed, this is the issue and the solution. I've just created a simple shell script that does exactly this:
adb uninstall <packagename>
ionic run android
until this will be incorporated in Ionic. uninstalling a package that doesn't exist should fail silently and it does, so that's great.

The solution works perfectly fine when I use ionic run android and runs with no errors on my device. But when I build it and get the .apk file and install it, the app stops working after showing the splash screen. Here is the detail: http://forum.ionicframework.com/t/blank-white-screen-android-apk/30300

Can't FB not just use meaningful error codes? NEW_VERSION_OLDER_THAN_INSTALLED would be infinitely clearer than INSTALL_FAILED_VERSION_DOWNGRADE which describes, and requires prior knowledge of, some internal process rather than what the error is to the end developer.

I'm not sure it matters if the version is actually newer or not. I get the same error message if I download my app from the playstore (v 3.5.2) and then try and install over the top of it my latest apk (3.5.4).

Though this may also have something to do with the version codes? Since I've noticed when uploaded multiple architecture builds to the play console the version codes are quite different (like 4195757)

adb uninstall <package-name>worked for me

Was this page helpful?
0 / 5 - 0 ratings