Bug 23811 - Using Publish Android Application tool with JDK 7 produces APK that fails to install on some devices
Summary: Using Publish Android Application tool with JDK 7 produces APK that fails to ...
Status: RESOLVED DUPLICATE of bug 22897
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: 3.7
Hardware: PC Windows
: High major
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2014-10-14 06:46 UTC by Frank Buckley
Modified: 2015-02-03 18:34 UTC (History)
12 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Frank Buckley 2014-10-14 06:46:24 UTC
With Xamarin Android and JDK 7u67, using Publish Android Application tool produces an APK that fails after download from Google Play (and presumably others) on some devices. The problem relates to signing the APK.

To reproduce:

* Publish Android app using Publish Android Application tool
* Attempt to install APK to device using adb install ...

Result on Nexus 7, Android 4.4.4:

* Success

Result on Samsung Galaxy Tab 3, Android 4.2.2:


This appears to be related to changes in jarsigner in JDK 7:


Workaround (at least on a Galaxy Tab 3):

* Sign APK using jarsigner from command prompt with -sigalg SHA1withRSA -digestalg SHA1 options.
Comment 1 Frank Buckley 2014-10-14 06:49:10 UTC
I should add - this is using the tool from Visual Studio - I have not tested from Xamarin Studio on Mac.
Comment 2 narayanp 2014-10-15 10:15:11 UTC
I have tried to reproduce this issue and able to reproduce. I followed the below steps to reproduce this issue:

1. Publish Android app using Publish Android Application tool in VS.
2. Install APK to device using adb install ...

I observed that the published APK is installed successfully on Samsung Galaxy S5 (4.4.2) and Samsung Galaxy Note 3 (4.4.2). But same APK installation is failed on Samsung Galaxy Tab 3 (4.2.2) and shows the below error: 

adb Log: https://gist.github.com/sunil360/f1e780052c9dee2eb22d

Environment info: 
Xamarin (9e6752d7279ca6b20eb4f728e50cdfaf4207da61)
Xamarin.Android (c0168255507205e3f50aba560ccf971c41a682ff)
Xamarin.iOS (6049af67092da016508817b895787e66f70f39ad)
Comment 3 Frank Buckley 2014-10-15 13:21:09 UTC
I should add that the faulty APK will successfully upload to Google Play.

Customers will then report "package not signed correctly" errors.
Comment 4 Ray Kelly 2014-11-05 10:09:26 UTC
I am having the same issue reported by my users on Galaxy 3.  App uploads fine to Google Play but fails to install with "not signed properly" on some devices.
Comment 5 Paul Roy 2015-01-30 10:59:27 UTC
I just encountered this problem and it took me hours to finally be able to understand.

I signed my apks from my previous PC (Windows 7), no problem
I sign them from from my new PC (Windows 8, jdk 7 only), push to google play, no problem on upload and a few hours later this just explodes on all of the testing devices.

I was finally able to push a correction by signing my app manually. It seems another fix was to use a jdk6 (I find this particularly horrible).

I really hope this get fixed soon as this is a major problem for deployments, especially because google play thinks the APK is okay.
I'm willing to help if you need info / test for the fix.
Comment 6 Alexandre Rocha Lima e Marcondes 2015-02-03 07:25:54 UTC
It would be great to be able to choose the algorithm when using the JDK 7 during the publishing process.
Comment 7 Alexandre Rocha Lima e Marcondes 2015-02-03 07:30:52 UTC
Just to give notice to Xamarin, there are duplicates of this report or at least somewhat related regarding the signing algorithm and JDK 7:

* https://bugzilla.xamarin.com/show_bug.cgi?id=24539
* https://bugzilla.xamarin.com/show_bug.cgi?id=22897
* https://bugzilla.xamarin.com/show_bug.cgi?id=13154
Comment 8 Peter Collins 2015-02-03 18:34:45 UTC

*** This bug has been marked as a duplicate of bug 22897 ***