试图与jarsigner.exe手动签署Android包并安装有adb.exe [英] Trying to manually sign android package with jarsigner.exe and install with adb.exe

查看:133
本文介绍了试图与jarsigner.exe手动签署Android包并安装有adb.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图使用jarsigner.exe和adb.exe手动签署Android包和一个API V8仿真器上安装它。我创建了一个简单的HelloAndroid项目,将使用位于用户.android目录debug.keystore生成一个签名HelloAndroid.apk。当从Eclipse的启动,它建立并安装在模拟器上的apk没有问题。

I've been trying to use the jarsigner.exe and adb.exe to manually sign an android package and install it on a API V8 emulator. I created a simple HelloAndroid project and it would generate a signed HelloAndroid.apk using the debug.keystore located in the user's .android directory. When launching from Eclipse, it builds and installs the apk on the emulator without a problem.

我用过Android工具未签名的应用程序包导出到一个单独的目录。我签署并zipAligned包装和使用亚行安装,但收到的错误:

I used the android tools to export an unsigned application package to a separate directory. I signed and zipAligned the package and used adb to install it but received the error:

Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]

我用下面的命令上签字。

I used the following command to sign it.

jarsigner -verbose -keystore c:\users\jhwong\.android\debug.keystore
     -storepass android -keypass android -digestalg SHA-1 -sigalg SHA1withRSA
     -sigfile CERT -signedjar temp\HelloWorld2.apk
      temp\HelloWorld.unsigned.apk androiddebugkey
   adding: META-INF/MANIFEST.MF
   adding: META-INF/CERT.SF
   adding: META-INF/CERT.RSA
  signing: res/layout/main.xml
  signing: AndroidManifest.xml
  signing: resources.arsc
  signing: res/drawable-hdpi/icon.png
  signing: res/drawable-ldpi/icon.png
  signing: res/drawable-mdpi/icon.png
  signing: classes.dex

这并没有给我任何错误,只是为了确保我跑:

That did not give me any errors and just to makes sure I ran:

jarsigner -verify -verbose temp\HelloWorld2.apk

这表明罐子,验证每个文件签署和清单的一部分。

It showed the jar was verified and each file signed and part of the manifest.

我跑 zipalign -v 4 TEMP \ HelloWorld2.apk TEMP \ HelloWorld3.apk 其中完成没有一个错误。 然后使用 ADB安装-r TEMP \ HelloWorld3.apk

I ran zipalign -v 4 temp\HelloWorld2.apk temp\HelloWorld3.apk which finished without an error. Then used adb install -r temp\HelloWorld3.apk.

我见过几个相关的主题和文章暗示这些方向,但我很困惑,为什么它没有手动经文使用Eclipse构建签名的软件包无法正常工作。我甚至采取了从Eclipse中内置的包,并能够使用adb.exe安装它,所以我已经收窄签订包。我试过,我已经从密钥工具生成的密钥库,但他们没有工作,以及这就是为什么我尝试了debug.keystore。

I've seen several related threads and articles suggesting these directions but I'm perplexed as to why it doesn't work manually verses using Eclipse to build the signed package. I've even taken the package built from Eclipse and was able to use adb.exe to install it so I've narrowed it to signing the package. I've tried keystores that I've generated from the keytool but they didn't work as well which is why I tried the debug.keystore.

我想AP preciate,如果他们发现什么毛病我的jarsigner code的任何建议。

I'd appreciate any advice if they noticed anything wrong with my jarsigner code.

推荐答案

我们有此相同的问题。尝试使用下面的参数值:

We had this exact same problem. Try using the following parameter values:

jarsigner ... -digestalg SHA1 -sigalg MD5withRSA ...

顺便说一句,使用显式sigalg和digestalg似乎是强制使用JDK 7。

By the way, using explicit sigalg and digestalg seems to be mandatory with JDK 7.

这篇关于试图与jarsigner.exe手动签署Android包并安装有adb.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆