[WORKAROUND] "ionic run" started uninstalling before installing

Hi,

I started using:
ionic platform add android@5.0.0 (instead of just android)
to get the diagnostic plugin to work. But since I’ve done this, when i use
ionic run (which defaults to android)
the application gets uninstalled before installing the latest build.

This means my localStorage and database gets wiped between installs.
This did not happen before.

Any ideas what’s changed or how to stop it being uninstalled first?

Thanks.

I hate to bump, but does anyone know how to prevent the app from being uninstalled first when using ionic run?

Same here. At the moment i’m not sure why it happens.

So glad I’m not the only one!

It must be ionic that’s doing it, as ionic controls the installation process.

Found the change:

Quick workaround…

After doing “ionic platform add”, find the file:

*/platforms/android/cordova/lib/device.js

edit lines 94-97 from this:

return Adb.uninstall(resolvedTarget.target, pkgName) .then(function() { return Adb.install(resolvedTarget.target, apk_path, {replace: true}); }).then(function() {

to this:
//return Adb.uninstall(resolvedTarget.target, pkgName) //.then(function() { return Adb.install(resolvedTarget.target, apk_path, {replace: true})/*; })*/.then(function() {

commenting out the uninstall sections.