Bug 60444 - Apksigner fails to sign certain projects that define a low targetSdkVersion in their manifests
Summary: Apksigner fails to sign certain projects that define a low targetSdkVersion i...
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 8.2 (15.6)
Hardware: All All
: Normal normal
Target Milestone: 15.6
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2017-10-30 21:16 UTC by Peter Collins
Modified: 2018-01-08 20:24 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: Yes
Last known good build: d15-5

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 or GitHub 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:
Status:
RESOLVED FIXED

Description Peter Collins 2017-10-30 21:16:25 UTC
I'm seeing one "negative" change in behavior with the introduction of apksigner support. Projects which define a targetSdkVersion lower than 10 (and also have no minimum defined) will now fail to create a signed .apk with the following error messaging. This is not a fatal scenario when using the signing logic in d15-5.

>  /Users/xamarinqa/Library/Developer/Xamarin/android-sdk-macosx/build-tools/26.0.2/apksigner sign --ks "/Users/xamarinqa/.local/share/Xamarin/Mono for Android/debug.keystore" --ks-pass pass:android --ks-key-alias androiddebugkey --key-pass pass:android --min-sdk-version 10 --max-sdk-version 8 --in bin/Debug/com.xamarin.example.phoneword-Signed.apk  (TaskId:342)
>  Min API Level (10) > max API Level (8) (TaskId:342)
> ...
> /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2487,2): error MSB6006: "apksigner" exited with code 1.

At the very least, if this scenario can no longer be supported, we should improve the msbuild error message to include actionable information for the user.

### Steps to reproduce ###
1) Download and build the following project:
https://github.com/xamarin/mobile-samples/tree/master/Phoneword/PhonewordAndroid
2) msbuild /t:SignAndroidPackage PhonewordAndroid.csproj

### Supplemental Info ###
15.5 (good) output:
https://gist.githubusercontent.com/pjcollins/ab67e515d4a34158417e2b8aabc5b5ce/raw/167b58896dece702dfd2b5b5cbe2a8115e46c69b/gistfile1.txt
master (bad) output:
http://xqa.blob.core.windows.net/gist/log-4c2af07d0b054654a56362e684fc6a09.txt

### Environment ###
Operating System: Mac OS X 10.13
Product Name: Xamarin.Android
Branch Name: mono-2017-10
Build Revision: a3ea085eb453d03d1aa4aa4a5b444cd6cf3ca2da
Comment 1 dean.ellis 2017-11-02 15:22:24 UTC
PR up https://github.com/xamarin/xamarin-android/pull/1003
Comment 2 dean.ellis 2017-11-03 07:11:56 UTC
Fixed in Xamarin-android/master/6299c6ec