简体   繁体   中英

Error: ADB exited with exit code 1 Failure [INSTALL_FAILED_VERSION_DOWNGRADE]

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?

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.

错误(失败 [INSTALL_FAILED_VERSION_DOWNGRADE])我只是清除缓存(应用程序管理器)并卸载应用程序,然后再次构建它,它对我有用。

If you are facing this problem and using physical device for development, problem is probably caused because you installed a version that you build and remove it later.

Solution is simple, for my case, I just installed another build of my app and then go back to android studio and ran the flutter, again synced all the data, and I continued to develop.

This is what worked for me

adb shell pm uninstall "packagename"

and then install the app using adb or

flutter install

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM