adb - 如何在不保留数据的情况下重新安装应用程序? [英] adb - How to reinstall an app, without retaining the data?
问题描述
adb install foo.apk
当使用这个命令时,如果apk存在,我应该得到错误*Failure [INSTALL_FAILED_ALREADY_EXISTS]*
When using this command, if the apk exists, I should get the error *Failure [INSTALL_FAILED_ALREADY_EXISTS]*
adb install -r myapp-release.apk
在这种情况下,现有的apk将被替换,保留旧数据根据文档,
In this case,the existing apk will be replaced, by retaining old data according to the docs,
'-r' 表示重新安装应用程序,保留其数据
'-r' means reinstall the app, keeping its data
现在如何重新安装应用程序,但应删除所有以前的数据?
Now how do I reinstall the app, but all previous data should be erased?
编辑
我知道我们可以做到这一点
I know we can do this
adb uninstall com.package.foo & adb install foo.apk
我只是想知道adb本身是否有命令或其他东西.
I just wanted to know if there is a command or something in adb itself.
推荐答案
安装前清理数据如下:
adb shell pm clear com.package.foo
然后就可以正常安装了:
then you can install normally using:
adb install foo.apk
或者只是运行你的 IDE
or just run through your IDE
这篇关于adb - 如何在不保留数据的情况下重新安装应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!