1

借助这篇文章“Android:以编程方式安装 .apk”。我已在我的 Android 2.3 设备上成功进行了自动升级/自动安装:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + "app.apk")), "application/vnd.android.package-archive");
startActivity(intent);

但它在 Android 4.0(ICS) 设备上失败并给了我错误消息:

an existing package by the same name with a conflicting signature is already installed

有什么问题?

谢谢!

4

1 回答 1

2

这可能是因为您首先从 Eclipse 将您的应用程序运行到设备(使用一个密钥对您的应用程序进行签名),然后通过下载 apk 文件(使用与 Eclipse 不同的密钥签名)尝试通过一些更新服务再次安装它来自网络。这会导致签名冲突。

于 2011-12-12T14:44:33.717 回答