Android apk 安装:如何清除旧版本的文件? [英] Android apk install: How to clear files from old version?

查看:137
本文介绍了Android apk 安装:如何清除旧版本的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我安装新版本的 .apk 时,这会覆盖旧版本而不删除它:在新版本中,我删除了一些文件(使用 NDK 生成的库)---但是在设备上,旧文件是还在.

When I install a new version of my .apk, this overwrites the old version without deleting it: In the new version, I deleted some files (libraries generated with NDK) --- but on the device, the old files are still there.

如何确保每次安装新版本时,安装前都会删除所有旧文件?

How can I ensure that whenever a new version is installed, all old files will be deleted before the installation?

编辑/澄清:此问题要求为我的应用程序的现有用户提供解决方案.我知道我可以通过在安装新版本之前卸载它来自己清理应用程序.但其他用户不会这样做——将旧文件保留在他们的设备上.

Edit/Clarification: This question asks for a solution for existing users of my application. I know that I can clean up the application myself by uninstalling it before installing the new version. But other users will not do this --- keeping the old files on their devices.

推荐答案

就在重新安装应用程序之前

Just before re-installing your application

adb install -r myapp-release.apk

您有两个选择:
第一个是在安装新版本之前卸载您的应用程序.

You have 2 options:
First one is to uninstall your application before installing the new version.

adb uninstall com.your.package

二是在安装新版本前清除应用数据.

Second one is to clear application data before installing the new version.

adb shell pm clear com.your.package

这篇关于Android apk 安装:如何清除旧版本的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆