File: Xamarin.Android.Common.targets
Line: 2007
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(3,3): Error: Input string was not in a correct format.
at System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) [0x0005f] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/number.cs:1077
at System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00013] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/number.cs:745
at System.Int32.Parse (System.String s) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/int32.cs:120
at Xamarin.Android.Tasks.ManifestDocument.CalculateVersionCode (System.String currentAbi, System.String versionCodePattern, System.String versionCodeProperties) [0x000bb] in <96027da06dd5411688a31011072e256f>:0
at Xamarin.Android.Tasks.Aapt.GenerateCommandLineCommands (System.String ManifestFile, System.String currentAbi, System.String currentResourceOutputFile) [0x000d7] in <96027da06dd5411688a31011072e256f>:0
at Xamarin.Android.Tasks.Aapt.ProcessManifest (Microsoft.Build.Framework.ITaskItem manifestFile) [0x0017d] in <96027da06dd5411688a31011072e256f>:0
at System.Threading.Tasks.Parallel+<>c__DisplayClass30_0`2[TSource,TLocal].<ForEachWorker>b__0 (System.Int32 i) [0x00000] in <bb7b695b8c6246b3ac1646577aea7650>:0
at System.Threading.Tasks.Parallel+<>c__DisplayClass17_0`1[TLocal].<ForWorker>b__1 () [0x0020b] in <bb7b695b8c6246b3ac1646577aea7650>:0
at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2886
at System.Threading.Tasks.Task.InnerInvokeWithArg (System.Threading.Tasks.Task childTask) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2910
at System.Threading.Tasks.Task+<>c__DisplayClass178_0.<ExecuteSelfReplicating>b__0 (System.Object <p0>) [0x00086] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2635 (DistributorRoute.Android)
@jeacovygayle can you post your Properties/AndroidManifest.xml file? Is android:versionCode valid?
You might also look in obj/Debug/android/AndroidManifest.xml and see if that one is any different.
You might also want to look at AndroidVersionCodePattern if you have set that manually.
This bug occurs when the "Version Number" field of the Android Manifest uses a decimal like "1.2" instead of an integer like "1".
Version numbers with decimals are normal and this seems like bad behavior in the Android build. In addition it would help to validate the field rather than throwing an exception deep in the build framework.
I ran into this bug, as did this StackOverflow user:
https://stackoverflow.com/questions/52157897/xamarin-android-targets-fails-with-error-input-string-was-not-in-a-correct-form
And this Xamarin forums user:
https://forums.xamarin.com/discussion/115104/the-aapt-task-failed-unexpectedly
@b9chris the "Version Number" (or android:versionCode in the manifest) is defined by Google as an "int". As a result It cannot contain decimal values. The android:versionName however is a free form string.
https://developer.android.com/guide/topics/manifest/manifest-element#vcode
Yeah, I saw that after, so:
1) The error should clearly state this so it's not some confusing error deep in the framework.
2) The field should be validated, clearly explaining this weird limitation imposed by Android
3) It might be smart to change the label on this field to "Deployment Sequence Number" so no one gets the impression this is a version number with all the typical usage, since typical usage will break it.
Release status update
A new Preview version has now been published that includes the fix to improve the error message for this scenario. The fix is not yet included in a Release version. I will update this item again when a Release version is available that includes the fix.
The fix is not yet available on macOS. I will update this item again when a Preview version with the fix is available on macOS.
Fix included in Xamarin.Android 10.0.99.100.
Fix included on Windows in Visual Studio 2019 version 16.4 Preview 1. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview.
Fix not yet available on macOS.
Release status update
A new Preview version has now been published for macOS that includes the fix for this item.
Fix included in Xamarin.Android 10.1.0.1.
Fix included on macOS in Visual Studio 2019 for Mac version 8.4 Preview 1. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.
Release status update
A new Release version has now been published on Windows that includes the fix for this item. The fix is not yet published in a Release version on macOS. I will update this item again when a Release version is available on macOS that includes the fix.
Fix included in Xamarin.Android 10.1.0.30.
Fix included on Windows in Visual Studio 2019 version 16.4. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/.
(Fix also included on macOS in Visual Studio 2019 for Mac version 8.4 Preview 2.1 and higher. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.)
Release status update
A new Release version has now been published on macOS that includes the fix for this item.
Fix included in Xamarin.Android 10.1.1.0.
Fix included on macOS in Visual Studio 2019 for Mac version 8.4. To get the new version that includes the fix, check for the latest updates on the Stable updater channel.
(Fix also included on Windows in Visual Studio 2019 version 16.4 and higher. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/.)
Most helpful comment
This bug occurs when the "Version Number" field of the Android Manifest uses a decimal like "1.2" instead of an integer like "1".
Version numbers with decimals are normal and this seems like bad behavior in the Android build. In addition it would help to validate the field rather than throwing an exception deep in the build framework.
I ran into this bug, as did this StackOverflow user:
https://stackoverflow.com/questions/52157897/xamarin-android-targets-fails-with-error-input-string-was-not-in-a-correct-form
And this Xamarin forums user:
https://forums.xamarin.com/discussion/115104/the-aapt-task-failed-unexpectedly