java 为什么签名的 android apk 不在模拟器上运行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2551249/
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
Why signed android apk is not running on emulator
提问by Muhammad Maqsoodur Rehman
I have made a signed apk of an android project. Whenever my client try to run it on the emulator, he faces the following error message:
我制作了一个 android 项目的签名 apk。每当我的客户尝试在模拟器上运行它时,他都会遇到以下错误消息:
D:\Android\android-sdk-
windows\tools>adb install -r abc.apk
500 KB/s (6940708 bytes in 13.534s)
pkg: /data/local/tmp/abc.apk
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
What is the resolution?
分辨率是多少?
回答by Dan Osipov
In my case it was because I signed it on a machine running JDK 7. Downgrading to JDK 6 fixed the problem. Thanks java.lang.SecurityException when install apkfor the suggestion!
就我而言,这是因为我在运行 JDK 7 的机器上对其进行了签名。降级到 JDK 6 解决了该问题。感谢java.lang.SecurityException 安装 apk时的建议!
回答by Christopher Orr
As mentioned by steelbytes, the error INSTALL_PARSE_FAILED_NO_CERTIFICATESsuggests that the APK isn't signed like you think it is.
正如 steelbytes 所提到的,该错误INSTALL_PARSE_FAILED_NO_CERTIFICATES表明 APK 没有像您想象的那样签名。
Run this command to verify which certificate was used to sign the APK:jarsigner -verify -verbose -certs abc.apk
运行此命令以验证使用哪个证书对 APK 进行签名:jarsigner -verify -verbose -certs abc.apk
For each entry in the APK, you should see something like this:
对于 APK 中的每个条目,您应该看到如下内容:
sm 152412 Wed Oct 14 14:16:52 CEST 2009 classes.dex
X.509, CN=Meebo, OU=Meebo, O=Meebo, L=Mountain View, ST=California, C=US
[certificate is valid from 28/10/08 06:49 to 13/08/82 07:49]
Otherwise, if the APK isn't signed, you'll get the message jar is unsigned.
否则,如果 APK 未签名,您将收到消息jar is unsigned。
回答by Emran Hamza
try below code it's worked for me.
试试下面的代码,它对我有用。
Below line run when your jdk version is 6 for singing the apk
H:\Keytool>"C:\Program Files\Java\jdk1.6.0_09\bin\jarsigner.exe" -verbose -keystore donate.keystore "H:\Keytool\yourapkName.apk.apk" donate.keystore
Below line run when your jdk version is 7 for singing the apk
H:\Keytool>"C:\Program Files\Java\jdk1.7.0_21\bin\jarsigner.exe" -verbose -keyst
ore denote.keyStore "H:\Keytool\yourapkName.apk" denote.keyStore -digestalg SHA1 -sigalg MD5withRSA
回答by Scott Merritt
As Dan pointed out, check if you're running JDK 7. More info: http://code.google.com/p/android/issues/detail?id=19567
正如丹指出的那样,检查您是否正在运行 JDK 7。更多信息:http: //code.google.com/p/android/issues/detail?id=19567
回答by Khattab
You can run the Command:
您可以运行命令:
C:\Program Files\Android\android-sdk\platform-tools>adb logcat
It will give you a more detail on which exact file is not signed:
它将为您提供有关未签名确切文件的更多详细信息:
Package has no certificates at entry assets/META-INF/AIR/application.xml; ignoring!
回答by the100rabh
You could check if the client has not disabled installation of unsigned apps in the emulator.
您可以检查客户端是否没有禁止在模拟器中安装未签名的应用程序。

