gpt4 book ai didi

android - 包 xyz 在设置中具有不匹配的 uid : 10044 on disk, 10045

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:00:52 24 4
gpt4 key购买 nike

我找到了一个在虚拟机中安装 Android-x86 的简单指南 (guide)。
连接到 Eclipse 一切正常,但在 VM 上安装我的应用程序失败并出现以下错误:

06-21 22:40:26.390: INFO/PackageManager(2439): /data/app/xyz.apk changed; unpacking
06-21 22:40:26.390: ERROR/PackageManager(2439): Package xyz has mismatched uid: 10044 on disk, 10045 in settings
06-21 22:40:26.390: WARN/PackageManager(2439): Native ABI mismatch from package file
06-21 22:40:26.390: WARN/PackageManager(2439): Package couldn't be installed in /data/app/xyz-1.apk

我在 google 上搜索错误并找到了一个小的 Python 脚本来解决这个问题,但它不起作用 ( script )。执行脚本后,我得到了同样的错误。

我使用 Android-x86 2.2 generic,更多细节可以在这里找到:Release 2.2

有没有可能解决这个问题?

编辑:

我测试了所有 2.2 版本。一般只有 generic 和 sparta 工作,但是没有人接受我的 apk。
试过 adb install <packagefile>也是。

编辑2:

我已经尝试了@Vlad 推荐的工具。它在签署 apk 后部分工作。最后我用了 apkTools并将 apkEdit 的旧文件替换为 apktool 中的新文件。
但是使用 adb 的安装挂断并显示消息 waiting for device 或什么都没有。如果我相信 eclipse DDMS,每次我尝试安装 apk 时,与设备的连接都会丢失。
这是我尝试安装普通 apk 时的失败:Failure [INSTALL_FAILED_INVALID_APK]

最佳答案

错误 Package xyz has mismatched uid: 10044 on disk, 10045 in settings 由存在的文件夹 /data/data/xyz/ 引起。

在此消息中,文件夹存在并且拥有与现在安装的 (10045) 不同的所有者 (10044)。这是由以前的不干净安装引起的。

例如,之前的安装因一些错误而失败,并且不会删除创建的文件夹。

因为文件夹中可以是来自其他应用程序的数据,android 不允许使用它。 PackageManager 尝试以不同的方式修复它,但如果不能这样做 - 它会获取应用不同的目录并显示此消息。

更好的解决方案 - 安装应用程序并彻底删除它。之后再次安装。

另一种解决方案 - 以某些方式删除文件夹 /data/data/xyz/。可能您需要 root 权限。

来自 PackageManager 的代码(注释可能非常有帮助):

            // This is a normal package, need to make its data directory.
dataPath = getDataPathForPackage(pkg.packageName, 0);

boolean uidError = false;

if (dataPath.exists()) {
// XXX should really do this check for each user.
mOutPermissions[1] = 0;
FileUtils.getPermissions(dataPath.getPath(), mOutPermissions);

// If we have mismatched owners for the data path, we have a problem.
if (mOutPermissions[1] != pkg.applicationInfo.uid) {
boolean recovered = false;
if (mOutPermissions[1] == 0) {
// The directory somehow became owned by root. Wow.
// This is probably because the system was stopped while
// installd was in the middle of messing with its libs
// directory. Ask installd to fix that.
int ret = mInstaller.fixUid(pkgName, pkg.applicationInfo.uid,
pkg.applicationInfo.uid);
if (ret >= 0) {
recovered = true;
String msg = "Package " + pkg.packageName
+ " unexpectedly changed to uid 0; recovered to " +
+ pkg.applicationInfo.uid;
reportSettingsProblem(Log.WARN, msg);
}
}
if (!recovered && ((parseFlags&PackageParser.PARSE_IS_SYSTEM) != 0
|| (scanMode&SCAN_BOOTING) != 0)) {
// If this is a system app, we can at least delete its
// current data so the application will still work.
int ret = mInstaller.remove(pkgName, 0);
if (ret >= 0) {
// TODO: Kill the processes first
// Remove the data directories for all users
sUserManager.removePackageForAllUsers(pkgName);
// Old data gone!
String prefix = (parseFlags&PackageParser.PARSE_IS_SYSTEM) != 0
? "System package " : "Third party package ";
String msg = prefix + pkg.packageName
+ " has changed from uid: "
+ mOutPermissions[1] + " to "
+ pkg.applicationInfo.uid + "; old data erased";
reportSettingsProblem(Log.WARN, msg);
recovered = true;

// And now re-install the app.
ret = mInstaller.install(pkgName, pkg.applicationInfo.uid,
pkg.applicationInfo.uid);
if (ret == -1) {
// Ack should not happen!
msg = prefix + pkg.packageName
+ " could not have data directory re-created after delete.";
reportSettingsProblem(Log.WARN, msg);
mLastScanError = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
return null;
}
// Create data directories for all users
sUserManager.installPackageForAllUsers(pkgName,
pkg.applicationInfo.uid);
}
if (!recovered) {
mHasSystemUidErrors = true;
}
} else if (!recovered) {
// If we allow this install to proceed, we will be broken.
// Abort, abort!
mLastScanError = PackageManager.INSTALL_FAILED_UID_CHANGED;
return null;
}
if (!recovered) {
pkg.applicationInfo.dataDir = "/mismatched_uid/settings_"
+ pkg.applicationInfo.uid + "/fs_"
+ mOutPermissions[1];
pkg.applicationInfo.nativeLibraryDir = pkg.applicationInfo.dataDir;
String msg = "Package " + pkg.packageName
+ " has mismatched uid: "
+ mOutPermissions[1] + " on disk, "
+ pkg.applicationInfo.uid + " in settings";
// writer
synchronized (mPackages) {
mSettings.mReadMessages.append(msg);
mSettings.mReadMessages.append('\n');
uidError = true;
if (!pkgSetting.uidError) {
reportSettingsProblem(Log.ERROR, msg);
}
}
}
}
pkg.applicationInfo.dataDir = dataPath.getPath();

关于android - 包 xyz 在设置中具有不匹配的 uid : 10044 on disk, 10045,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6431759/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com