[英]INSTALL_PARSE_FAILED_NO_CERTIFICATES after building project in Eclipse
I had an android project in NetBeans(using NBAndroid) - apk installed successfully every time, then, I switched to Eclipse, export the .apk, and tried to install it on an emulator. 我在NetBeans中有一个android项目(使用NBAndroid) - 每次安装成功apk,然后,我切换到Eclipse,导出.apk,并尝试在模拟器上安装它。
adb -s emulator-5554 install MyApkName.apk
and it says 它说
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
In LogCat appeared that line 在LogCat中出现了这一行
03-11 10:55:00.710: E/PackageParser(77): Package com.package.name has no certificates at entry res/layout/chatrow.xml; ignoring!
Found it! 找到了! I was having this problem with 'ant' and it was due to this CAUTION mentioned in the documentation: 我遇到了'ant'这个问题,这是由于文档中提到的这个注意事项:
http://developer.android.com/guide/publishing/app-signing.html#signapp http://developer.android.com/guide/publishing/app-signing.html#signapp
Caution: As of JDK 7, the default signing algorithim has changed, requiring you to specify the signature and digest algorithims (-sigalg and -digestalg) when you sign an APK. 警告:从JDK 7开始,默认签名算法已更改,要求您在签署APK时指定签名和摘要算法(-sigalg和-digestalg)。
I have JDK 7, but it is probably the same issue. 我有JDK 7,但它可能是同一个问题。 In my Ant log, I used -v for verbose and it showed 在我的Ant日志中,我使用了-v来表示详细信息
$ ant -Dadb.device.arg=-d -v release install
[signjar] Executing 'C:\Program Files\Java\jdk1.7.0_03\bin\jarsigner.exe' with arguments:
[signjar] '-keystore'
[signjar] 'C:\cygwin\home\Chloe\pairfinder\release.keystore'
[signjar] '-signedjar'
[signjar] 'C:\cygwin\home\Chloe\pairfinder\bin\PairFinder-release-unaligned.apk'
[signjar] 'C:\cygwin\home\Chloe\pairfinder\bin\PairFinder-release-unsigned.apk'
[signjar] 'mykey'
[exec] pkg: /data/local/tmp/PairFinder-release.apk
[exec] Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
I signed the JAR manually and zipaligned it, but it gave a slightly different error: 我手动签署了JAR并对其进行了zipaligned,但它给出了一个稍微不同的错误:
$ "$JAVA_HOME"/bin/jarsigner -sigalg MD5withRSA -digestalg SHA1 -keystore release.keystore -signedjar bin/PairFinder-release-unaligned.apk bin/PairFinder-release-unsigned.apk mykey
$ zipalign -v -f 4 bin/PairFinder-release-unaligned.apk bin/PairFinder-release.apk
$ adb -d install -r bin/PairFinder-release.apk
pkg: /data/local/tmp/PairFinder-release.apk
Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]
641 KB/s (52620 bytes in 0.080s)
I found that answered here. 我发现这里回答了。
How to deal with INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES without uninstallation 如何在不卸载的情况下处理INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES
I only needed to uninstall it and then it worked! 我只需要卸载它然后它工作!
$ adb -d uninstall com.kizbit.pairfinder
Success
$ adb -d install -r bin/PairFinder-release.apk
pkg: /data/local/tmp/PairFinder-release.apk
Success
641 KB/s (52620 bytes in 0.080s)
Now I only need modify the build.xml to use those options when signing! 现在我只需要在签名时修改build.xml以使用这些选项!
尝试将项目而不是应用程序(.apk)文件导入eclipse,然后尝试运行它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.