Wednesday, November 16, 2011

Re: [android-developers] Problems when signing APKs with Java 7.

On Thu, Nov 17, 2011 at 3:20 AM, BoD <bodlulu2@gmail.com> wrote:
> Hi!
>
> I just spent a few hours on a signature problem when building our project
> with ant on a machine that has (Oracle's) Java 7 installed.
> When trying to install this apk, I have this error:
> Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
>
> After looking inside the MANIFEST.MF file inside the apk, I noticed that the
> digests are in the form:
> SHA-256-Digest: tXIm+feek/QDGP6yrxtgWDHyfl+XaND6lXbsY9gjZrA=
> Whereas when building with Java 6, they have the form:
> SHA1-Digest: lPHIYoqZ+2OpY0LPumyDkUdNdoc=
>
> I then saw in the (Java 7) jarsign documentation the -digestalg options
> (http://download.oracle.com/javase/7/docs/technotes/tools/windows/jarsigner.html).
> When signing manually the apk with jarsign (instead of using the ant build),
> and passing -digestalg SHA1, I no longer have the problem.
>
> I was wondering if this was a known issue, and if yes, is there anyway to
> fix it in an 'ant friendly' way?
>

Java 7 is not officially supported, AFAIK. People on SO have been reporting
this, so I guess it's known :)

SHA256 is the new default in Java 7 jarsigner, so you need to specify the
-digestalg option to use SHA1, as you've found.Don't know if <signjar />
even supports specifying the digest algorithm, so you might want to create
an unsigned package and call jarsigner directly from your build script.
Or just use Java 6 and save yourself some trouble :)

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment