答案 0 :(得分:0)
更新应用时增加versionCode
事实上,您的应用的最新版本已安装到/data/app
,当设备重启时,设备将检查旧应用(v1.0)是否应该更新。但是,根据scanPackageLI()
frameworks/base/services/java/com/android/server/PackageManagerService.java
if (ps != null && !ps.codePath.equals(scanFile)) {
// The path has changed from what was last scanned... check the
// version of the new path against what we have stored to determine
// what to do.
if (pkg.mVersionCode < ps.versionCode) {
// The system package has been updated and the code path does not match
// Ignore entry. Skip it.
......
} else {
......
}
......
}
您可以找到versionCode
是否相同,旧应用不会更新。因此,当您想要更新旧应用时,需要在应用中增加versionCode
。