我在NetBeans中有一个android项目(使用NBAndroid) - 每次都安装apk,然后,我切换到Eclipse,导出.apk,并尝试将其安装在模拟器上。
adb -s emulator-5554 install MyApkName.apk
它说
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
在LogCat中出现了那行
03-11 10:55:00.710: E/PackageParser(77): Package com.package.name has no certificates at entry res/layout/chatrow.xml; ignoring!
答案 0 :(得分:4)
http://developer.android.com/guide/publishing/app-signing.html#signapp
警告:从JDK 7开始,默认签名算法已更改,要求您在签署APK时指定签名和摘要算法(-sigalg和-digestalg)。
我有JDK 7,但它可能是同一个问题。在我的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]
我手动签署了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)
我发现这里已经回答了。
How to deal with INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES without uninstallation
我只需要卸载它然后就可以了!
$ 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)
现在我只需要在签名时修改build.xml以使用这些选项!
答案 1 :(得分:0)
尝试将项目而不是应用程序(.apk)文件导入eclipse,然后尝试运行它。