gpt4 book ai didi

java - 在 Eclipse 中构建项目后安装 INSTALL_PARSE_FAILED_NO_CERTIFICATES

转载 作者:行者123 更新时间:2023-11-29 03:48:54 27 4
gpt4 key购买 nike

我在 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!

最佳答案

找到了!我在使用“ant”时遇到了这个问题,这是由于文档中提到的这个警告:

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,但这可能是同一个问题。在我的 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 以在签名时使用这些选项!

关于java - 在 Eclipse 中构建项目后安装 INSTALL_PARSE_FAILED_NO_CERTIFICATES,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9654417/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com