Problems when signing APKs with Java 7.

Showing 1-8 of 8 messages
Problems when signing APKs with Java 7. BoD 11/16/11 10:20 AM
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?

Thanks a lot!
Re: [android-developers] Problems when signing APKs with Java 7. Nikolay Elenkov 11/16/11 6:27 PM

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 :)

Re: [android-developers] Problems when signing APKs with Java 7. BoD 11/17/11 12:37 AM
Thanks for your answer.
I guess I was unlucky with my search terms because I did spent time a few hours googleing but did not find anything. If you have the SO links I'd appreciate it :)
Also if anybody from the Android tools team reads this, it would be a good idea to put a warning about this on the page http://developer.android.com/guide/publishing/app-signing.html

Thanks!

--
BoD
Re: [android-developers] Problems when signing APKs with Java 7. Nikolay Elenkov 11/17/11 1:37 AM
On Thu, Nov 17, 2011 at 5:37 PM, BoD <bodl...@gmail.com> wrote:
> Thanks for your answer.
> I guess I was unlucky with my search terms because I did spent time a few
> hours googleing but did not find anything. If you have the SO links I'd
> appreciate it :)

Here's one:

http://stackoverflow.com/questions/8115111/transitioning-android-dev-from-linux-to-windows-toolchain-signes-apk-differentl

Re: Problems when signing APKs with Java 7. gjs 11/17/11 8:20 PM
Hi,

Yes I can confirm the same problems happen with jarsigner & jdk 1.7
and Windows 7, must use jdk 1.6 or prior.

Regards

On Nov 17, 8:37 pm, Nikolay Elenkov <nikolay.elen...@gmail.com> wrote:


> On Thu, Nov 17, 2011 at 5:37 PM, BoD <bodlu...@gmail.com> wrote:
> > Thanks for your answer.
> > I guess I was unlucky with my search terms because I did spent time a few
> > hours googleing but did not find anything. If you have the SO links I'd
> > appreciate it :)
>
> Here's one:
>
> http://stackoverflow.com/questions/8115111/transitioning-android-dev-...

Re: [android-developers] Re: Problems when signing APKs with Java 7. Nikolay Elenkov 11/17/11 8:27 PM
On Fri, Nov 18, 2011 at 1:20 PM, gjs <garyjam...@gmail.com> wrote:
> Hi,
>
> Yes I can confirm the same problems happen with jarsigner & jdk 1.7
> and Windows 7, must use jdk 1.6 or prior.
>

Here's the related ADT issue:

http://code.google.com/p/android/issues/detail?id=19567

Re: [android-developers] Re: Problems when signing APKs with Java 7. BoD 11/18/11 12:37 AM
Thanks a lot for the link.

--
BoD
Re: Problems when signing APKs with Java 7. joebowbeer 12/16/11 12:41 PM
Here is a bug report and patch to Ant's signjar task:

https://issues.apache.org/bugzilla/show_bug.cgi?id=52344

More related discussion and proposed workarounds at:

http://stackoverflow.com/questions/8036422/android-signing-with-ant

Joe

On Nov 17, 8:27 pm, Nikolay Elenkov <nikolay.elen...@gmail.com> wrote:


> On Fri, Nov 18, 2011 at 1:20 PM, gjs <garyjamessi...@gmail.com> wrote:
> > Hi,
>
> > Yes I can confirm the same problems happen with jarsigner & jdk 1.7
> > and Windows 7, must use jdk 1.6 or prior.
>
> Here's the related ADT issue:
>
> http://code.google.com/p/android/issues/detail?id=19567