简体   繁体   English

为什么我的签名apk无法安装?

[英]Why will my signed apk not install?

I have been developing my app for a while and runing on a real device through Eclipse using Run As -> * Android Application * . 我已经开发了一段时间的应用程序,并使用Run As- > * Android Application *通过Eclipse在真实设备上运行 Now I am trying to distibute it to some beta users for the first time. 现在,我试图将其首次分发给某些Beta版用户。 I used Eclipse to create a signed app, using a new keystore that I generated through the wizard. 我使用Eclipse通过通过向导生成的新密钥库来创建签名的应用程序。 This appeared to work fine and when I check with Jarsign I get the message "Jar Verified", although there are a couple of warnings too. 这似乎工作正常,当我与Jarsign核对时,我收到消息“ Jar已验证”,尽管也有一些警告。 These are "This Jar contains entries whose certificate chain is not validated" and "Ths Jar contains signatures that do no include a timestamp". 它们是“此Jar包含未验证证书链的条目”和“此Jar包含不包含时间戳的签名”。

I then copied the resulting apk onto the device and opened it. 然后,我将生成的apk复制到设备上并打开它。 But got a message "This app was not installed". 但是收到消息“未安装此应用程序”。 And in log cat I can see: "Package has no certificates at entry ; Ignoring!" 在日志目录中,我可以看到: “包裹在输入时没有证书;请忽略!”

I found some people had suggested going back to JDK 6 (I did have 7 previously), but that didn't help. 我发现有人建议回到JDK 6(以前确实有7),但这并没有帮助。 A few people suggested it might be due to duplicate activities in the manifest so I checked the manifest thoroughly. 一些人建议这可能是由于清单中的重复活动,所以我彻底检查了清单。

What I have found is that if I rename the apk so that it is no longer exactly the same name as the last part of the package it suddenly works. 我发现,如果我将apk重命名,以使其不再与软件包的最后部分完全相同的名称,它将突然起作用。

So if the package is com.mydomain.myapp and the apk is myapp.apk I get the error, but if it's myapp_debug.apk it installs just fine. 因此,如果软件包是com.mydomain.myapp,而apk是myapp.apk,我会收到错误消息,但是如果是myapp_debug.apk,则安装就可以了。

I find this very confusing and more than a little worrying. 我觉得这很令人困惑,而且令人担忧。 I would like to publish this app for real eventually and I'm not sure if I've done something wrong. 我想最终发布该应用程序,但不确定是否做错了什么。

Based on your renaming makes it work description, you already have an app with the same package name installed on the device, but signed with a different certificate (probably the debug certificate used for eclipse-launch installs). 根据您的重命名使其能正常工作的描述,您已经在设备上安装了具有相同程序包名称的应用程序,但是使用了不同的证书(可能是用于Eclipse启动安装的调试证书)进行了签名。

You must simply remove the existing installation before you install your release version. 您必须简单地删除现有安装,然后再安装发行版本。 You can do that either from the settings menu, or with an ADB command of the form 您可以从“设置”菜单或使用以下格式的ADB命令来执行此操作

adb uninstall your.package.name

Note that this removal will wipe out the private data stored by the app - that's part of why you have to do it, to prevent an imposter (naturally having a different certificate) from easily grabbing data left behind by a real app. 请注意,此删除操作将清除应用程序存储的私人数据-这就是您必须执行此操作的部分原因,以防止冒名顶替者(自然拥有不同的证书)轻易获取真实应用程序留下的数据。

Remember also when distributing apps to others in this manner that they will need to allow unknown / non-market sources in their settings menu. 还请记住,以这种方式向他人分发应用程序时,他们将需要在其设置菜单中允许未知/非市场来源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM