安装失败,消息为 INSTALL_FAILED_DUPLICATE_PERMISSION…C2D_MESSAGE 种可能性

Installation failed with message INSTALL_FAILED_DUPLICATE_PERMISSION… C2D_MESSAGE possibilities

如果你是通过谷歌搜索来寻找这个错误的解决方案,下面的链接会给你一个答案,我的问题也有某种解释!)

可能与

重复

INSTALL_FAILED_DUPLICATE_PERMISSION… C2D_MESSAGE

等等!

我今天在直播中遇到了这个错误 project.User 505 错误无法安装 app.Then 我 运行 它在 IDE!

  • If you download an app with this mentioned issue from play store you will get an error with 505 when you try to install.
  • If you try to run it using your IDE you will get the error like in above image! (correct me if I am wrong)

那我在找原因

这是我的问题!

   <permission
        android:name="in.wptrafficanalyzer.locationroutedirectionmapv2.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />
    <uses-permission android:name="in.wptrafficanalyzer.locationroutedirectionmapv2.permission.MAPS_RECEIVE" />

令人惊讶的是另一位开发者针对特定用户的应用 phone 使用了相同的签名!妈的,那些复制粘贴今天碰上了!!

I think if I try to declare same permission in two applications with same package name this error can occur.(correct me if I am wrong)

这是我的 2 个问题?

1.Do 他们需要相同的权限?无论如何,他们会在相同的时候得到这个东西。假设应用程序 A 用户 a pkg.name 具有权限 permission.RECEIVE 应用程序 B 使用相同的包并具有另一个权限 CONFIGURE_SIP。当他们见面时会发生这种情况吗?(似乎是一个愚蠢的问题,但我想确认客户手机中的其他应用程序也有同样的东西!)

2.What are/is 还有其他可能发生此错误的可能性吗?

  1. An application defines a custom permission using signature level security
  2. You attempt to update the installed app with a version signed with a different key
  3. The test device is running Android 21 or newer with support for multiple users

this post 得到了 1 2 3 !他们是真的吗?如果是,关于它们的任何好的解释将是很好的,或者这个错误的任何其他原因?

提到的帖子中有很多好的答案!不是问如何解决这个问题!但是它是如何生成的!另外,如果我 mentioned/understood 有什么不对,请记下来!!

谢谢。


编辑正如我提到的,请注意,问题来自 Play 商店中已有的应用。关于其他应用程序,我不知道!它在客户的 mobile.Probably 中,它也来自 Play 商店,因为在我尝试 运行 之前甚至开发者选项都没有激活 mobile.He 我公司以前没有任何应用程序,因为 well.He 刚刚尝试下载应用程序时出现 505 错误并来修复它。

而且我的第一个选择是删除该权限,它使应用程序安装成功(不是正确的事情,但要确认问题出在哪里)。这就是我需要知道这个错误的可能性的原因!

您的问题不是权限问题。不可能有两个具有相同清单包的应用程序 name.It 必须是唯一的。因此系统认为用户尝试 reinstall/update 带有新签名证书的旧应用程序。来自 android 开发者 blog

If the signing certificate changes, trying to install the new application on to the device will fail until the old version is uninstalled.

编辑:

我运行 一些具有权限的测试。我认为,行为与应用程序包名称非常相似。仅当 100% 匹配时才会发生错误。结果: 应用程序 A(程序包 test.test)与应用程序 B(程序包 test.test2)

          package="test.test">

<permission
    android:name="test2.example.h"
    android:protectionLevel="signature" />

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="test.test2">
<permission
    android:name="test.example.hr"
    android:protectionLevel="signature" />
  1. 权限 A - test.example.h 与 B - test.example.h - DUPLICATE_PERMSSIONS 错误
  2. test.example 对比 test.example.h - 成功
  3. test.example.g vs test.example.h - 成功

uses-permission 不影响 errors/installations。但我认为如果尝试使用其他权限,您可以在 运行 时间内获得 SeciurityException。

@commonsware blogs 在Custom Permission Vulnerability and the 'L' Developer Preview:

中有详细解释

Near as I can tell, the “L” Developer Preview requires that all apps with a <permission> element for the same android:name value be signed by the same signing key. The actual protectionLevel or other values inside the <permission> does not matter. Even if they are identical, an app trying to define the <permission> will fail to install if an existing installed app already defines the <permission>. Specifically, the installation of the second app will fail with an INSTALL_FAILED_DUPLICATE_PERMISSION error.

@commonsware 的回答: