Issue
I'm using last version of flutter and dart. First I installed my app from play store and after that I've attached my device(Samsung S8+ with android 9) for debugging, it's shown me this error:
Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
After some searches I've done theses works:
uninstall from all user the currently installed copy
adb uninstall "Package name"
downgrade android:version from manifest.xml
and they haven't worked!
I realized my app version from app manager and I would edit version:
version: 3.8.0+62
-> version: 3.11.0+66
from pubspec.yaml
, it's shown me this:
signatures do not match previously installed version; ignoring!
I think the previous apk is already installed but it doesn't exist in system App manager.
Other projects working fine.
What should I do?
Solution
Following the below steps did it for me. Hopefully this will help others.
Possible Solution
On the terminal, run following commands (ensuring adb is on $PATH
):
$ adb uninstall [package_name]
[package_name]
here would be in the form com.domain.appname
.
$ adb install -r -d [path_to_debug_apk]
-d
allows version downgrade for debug builds.
-r
is to replace existing application and may be redundant if the uninstall succeeded in completely purging previous installed copy. I was just a bit paranoid and used it.
See $ adb help
for more details.
It is then possible to attach to this debug build from terminal using flutter attach
, and get the debug log on terminal just like flutter run
.
I believe now that it should be possible to execute flutter run
too after the first uninstall step without errors.
The error message and some back-story
I had a similar problem with flutter run
while trying to debug an app while I had a release version of it installed on the device already.
I got an adb error stating:
Error: ADB exited with exit code 1
Performing Streamed Install
adb: failed to install /path_to_project/build/app/outputs/flutter-apk/app.apk:
Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
Error launching application on [deviceName]
Like in your case, uninstalling the app from application manager on the phone did not remove this error.
Answered By - lost-and-found
Answer Checked By - Mary Flores (JavaFixing Volunteer)