已发布的 Android apk 出现错误“包文件未正确签名”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2519374/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 06:09:36  来源:igfitidea点击:

Published Android apk gives error "Package file was not signed correctly"

androidkeytooljarsignergoogle-play

提问by David Read

I recently uploaded my application to the android market however it's refusing to run when downloaded due to the error

我最近将我的应用程序上传到了 android 市场,但是由于错误,它在下载时拒绝运行

Package file was not signed correctly

包文件未正确签名

I first published the packet using eclipse, right click export, creating a keystore then publishing, however it refuses to work.

我首先使用 eclipse 发布数据包,右键单击导出,创建一个密钥库然后发布,但是它拒绝工作。

I then downloaded the keytool and jarsigner and used them to sign an upgrade which I posted instead. However this gives the same error.

然后我下载了 keytool 和 jarsigner 并使用它们来签署我发布的升级。但是,这会产生相同的错误。

I have no idea what I've done wrong, and since I cannot delete the application I cannot try and start again can anyone help me?

我不知道我做错了什么,而且由于我无法删除该应用程序,我无法尝试重新开始,有人可以帮助我吗?

Thanks

谢谢

回答by Mark B

You have your debug copy still installed on your device most likely. Now you have downloaded a different copy of the same app and it's causing this error.

您很可能仍将调试副本安装在您的设备上。现在您已经下载了同一个应用程序的不同副本,它导致了这个错误。

Uninstall the app completely from your device. Then download it from the market again and it should work.

从您的设备上完全卸载该应用程序。然后再次从市场下载它,它应该可以工作。

回答by Melloware

OK I had this same issue and none of the suggested resolutions worked for me. I was signing my app the same way I have been for 2 years and the Android Market was accepting it fine, just users could not download it from the Market with the "Package Not Signed" error.

好的,我遇到了同样的问题,没有一个建议的解决方案对我有用。我以与 2 年来相同的方式签署我的应用程序,Android Market 接受它很好,只是用户无法从 Market 下载它并显示“Package Not Signed”错误。

What it turned out to be was for another project I am working on I had JDK7 installed. It became the default JDK and for some reason the keytool for JDK7 is signing the package in a way that Android must not like. So I reverted to JDK 1.6.0_23 and re-ran my build and put it on the Market and everything went back to normal.

结果是我正在处理的另一个项目中安装了 JDK7。它成为了默认的 JDK,出于某种原因,JDK7 的 keytool 正在以一种 Android 不喜欢的方式对包进行签名。所以我恢复到 JDK 1.6.0_23 并重新运行我的构建并将它放在市场上,一切都恢复正常。

I hope this helps someone else.

我希望这对其他人有帮助。

回答by boltup_im_coding

On a tablet, note that if you install a debug version of the app and then uninstall it as normal (dragging to trash until it says "uninstall") that is not enough. Because tablets have the potential for multiple users, you HAVE to go to

在平板电脑上,请注意,如果您安装了该应用程序的调试版本,然后正常卸载(拖到垃圾箱直到显示“卸载”),这还不够。因为平板电脑具有供多个用户使用的潜力,所以您必须去

 Settings > Apps > All

and then scroll all the way to the very bottom. There, you will see your app. Tap it, and then hit Menuin the action bar (the three dots), and then uninstall for all users. Then you'll be good to go.

然后一直滚动到最底部。在那里,您将看到您的应用程序。点击它,然后点击Menu操作栏(三个点),然后点击uninstall for all users。然后你就可以走了。

回答by user3291147

Recently, I signed my apks from the command line and got this error. I solved this error through the instructions in this link:

最近,我从命令行签署了我的 apk 并收到此错误。我通过此链接中的说明解决了此错误:

http://developer.android.com/tools/publishing/app-signing.html

http://developer.android.com/tools/publishing/app-signing.html

$ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name

回答by Xavi Ivars

There's a problem when signing APKs with JDK7. You can solve it adding this to build.xml

使用 JDK7 签署 APK 时出现问题。你可以解决它添加这个到 build.xml

<presetdef name="signjar">
    <signjar sigalg="MD5withRSA" digestalg="SHA1" />
</presetdef>

Source: KIYUT Developer Blog

来源:KIYUT 开发者博客

回答by jqpubliq

This error usually occurs because you are trying to push an update which was signed with a different key than you used in the initial submission. You need to find the key you used the first time you published the application and use this to sign the update.

发生此错误通常是因为您尝试推送使用与初始提交中使用的密钥不同的密钥签名的更新。您需要找到您第一次发布应用程序时使用的密钥,并使用它来签署更新。

回答by Santiago Perez

I had the same problem with my developed app.

我开发的应用程序遇到了同样的问题。

Go to the App Manager, clear the data for the app, then force stop if it's running and uninstall it. Then try again to install from market. This worked for me.

转到应用程序管理器,清除应用程序的数据,如果它正在运行并强制停止并卸载它。然后再次尝试从市场安装。这对我有用。

https://market.android.com/details?id=net.trackmelite.GoogleMaps&feature=search_result

https://market.android.com/details?id=net.trackmelite.GoogleMaps&feature=search_result

回答by Soroush Olamaei

I am new to Android but I was able to resolvethe issue magically :D
I used Java 1.7 with my app and used command line utilities [keytool, jarsinger and zipalign] to sign my app and got the same error.
Then I went back to Eclipse and used the Android tool "Export Signed Application Package" with the same keystore I had originally published my app with; took that APK and used the command line to zipalign it.[Had to increment the versioncode in the manifest btw]. I unpublished the old APK and published this new one. Once you do this, do not test it immediately.
Not sure how long you have to wait but mine was working 4 hours later when I checked :)

我是 Android 新手,但我能够神奇地解决这个问题:D
我将 Java 1.7 与我的应用程序一起使用,并使用命令行实用程序 [keytool、jarsinger 和 zipalign] 对我的应用程序进行签名并得到相同的错误。
然后我回到 Eclipse 并使用 Android 工具“Export Signed Application Package”和我最初发布应用程序时使用的相同密钥库;使用该 APK 并使用命令行对其进行 zipalign。[顺便说一下,必须增加清单中的版本代码]。我取消发布旧的 APK 并发布了这个新的。一旦你这样做了,不要立即测试它
不知道你要等多久,但当我检查时,我的工作 4 小时后:)