Xamarin.Android.Targets fails with error "Input string was not in a correct format."

Viewed 3259

The error below contains "Input string was not in a correct format.", and I can't figure out what may be causing this issue.

I can post more complete project / logs if necessary. The project builds fine on iOS

Target _CreateBaseApk:
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error : Input string was not in a correct format.
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   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/2018-06/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/number.cs:1077 
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   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/2018-06/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/number.cs:745 
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   at System.Int32.Parse (System.String s) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/int32.cs:120 
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   at Xamarin.Android.Tasks.ManifestDocument.CalculateVersionCode (System.String currentAbi, System.String versionCodePattern, System.String versionCodeProperties) [0x000bb] in <83926d11b31545cc8ffa045c79833692>:0 
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   at Xamarin.Android.Tasks.Aapt.GenerateCommandLineCommands (System.String ManifestFile, System.String currentAbi, System.String currentResourceOutputFile) [0x000d7] in <83926d11b31545cc8ffa045c79833692>:0 
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   at Xamarin.Android.Tasks.Aapt.ProcessManifest (Microsoft.Build.Framework.ITaskItem manifestFile) [0x0017d] in <83926d11b31545cc8ffa045c79833692>:0 
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   at System.Threading.Tasks.Parallel+<>c__DisplayClass32_0`2[TSource,TLocal].<ForEachWorker>b__0 (System.Int32 i) [0x00000] in <0242286efc4a47b69b5a84e828f56ef8>:0 
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   at System.Threading.Tasks.Parallel+<>c__DisplayClass19_0`1[TLocal].<ForWorker>b__1 (System.Threading.Tasks.RangeWorker& currentWorker, System.Int32 timeout, System.Boolean& replicationDelegateYieldedBeforeCompletion) [0x000db] in <0242286efc4a47b69b5a84e828f56ef8>:0 
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error : --- End of stack trace from previous location where exception was thrown ---
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error : 
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   at System.Threading.Tasks.Parallel+<>c__DisplayClass19_0`1[TLocal].<ForWorker>b__1 (System.Threading.Tasks.RangeWorker& currentWorker, System.Int32 timeout, System.Boolean& replicationDelegateYieldedBeforeCompletion) [0x001f1] in <0242286efc4a47b69b5a84e828f56ef8>:0 
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   at System.Threading.Tasks.TaskReplicator+Replica`1[TState].ExecuteAction (System.Boolean& yieldedBeforeCompletion) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/external/corefx/src/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/TaskReplicator.cs:123 
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   at System.Threading.Tasks.TaskReplicator+Replica.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/external/corefx/src/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/TaskReplicator.cs:78 
Done building target "_CreateBaseApk" in project "WebOfTrust.Android.csproj" -- FAILED.

Done building project "WebOfTrust.Android.csproj" -- FAILED.

Build FAILED.

ViewModels/Client/WalletViewModel.cs(42,13,42,38): warning CS4014: Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.
ViewModels/PurchaseInApp/ItemCatalogViewModel.cs(97,30,97,32): warning CS0168: The variable 'ex' is declared but never used
ViewModels/PurchaseInApp/ItemCatalogViewModel.cs(202,30,202,32): warning CS0168: The variable 'ex' is declared but never used
ViewModels/Client/TrustAnchorListViewModel.cs(16,28,16,46): warning CS0169: The field 'TrustAnchorListViewModel._navigationService' is never used
ViewModels/ChildViewModelBase.cs(31,35,31,50): warning CS0067: The event 'ChildViewModelBase.IsActiveChanged' is never used
ViewModels/Client/PrivacyScenarioListViewModel.cs(15,28,15,46): warning CS0169: The field 'PrivacyScenarioListViewModel._navigationService' is never used
/Library/Frameworks/Mono.framework/Versions/5.16.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(2127,5): warning MSB3277: Found conflicts between different versions of "System.Net.Http" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error : Input string was not in a correct format.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   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/2018-06/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/number.cs:1077 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   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/2018-06/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/number.cs:745 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   at System.Int32.Parse (System.String s) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/int32.cs:120 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   at Xamarin.Android.Tasks.ManifestDocument.CalculateVersionCode (System.String currentAbi, System.String versionCodePattern, System.String versionCodeProperties) [0x000bb] in <83926d11b31545cc8ffa045c79833692>:0 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   at Xamarin.Android.Tasks.Aapt.GenerateCommandLineCommands (System.String ManifestFile, System.String currentAbi, System.String currentResourceOutputFile) [0x000d7] in <83926d11b31545cc8ffa045c79833692>:0 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   at Xamarin.Android.Tasks.Aapt.ProcessManifest (Microsoft.Build.Framework.ITaskItem manifestFile) [0x0017d] in <83926d11b31545cc8ffa045c79833692>:0 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   at System.Threading.Tasks.Parallel+<>c__DisplayClass32_0`2[TSource,TLocal].<ForEachWorker>b__0 (System.Int32 i) [0x00000] in <0242286efc4a47b69b5a84e828f56ef8>:0 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   at System.Threading.Tasks.Parallel+<>c__DisplayClass19_0`1[TLocal].<ForWorker>b__1 (System.Threading.Tasks.RangeWorker& currentWorker, System.Int32 timeout, System.Boolean& replicationDelegateYieldedBeforeCompletion) [0x000db] in <0242286efc4a47b69b5a84e828f56ef8>:0 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error : --- End of stack trace from previous location where exception was thrown ---
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error : 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   at System.Threading.Tasks.Parallel+<>c__DisplayClass19_0`1[TLocal].<ForWorker>b__1 (System.Threading.Tasks.RangeWorker& currentWorker, System.Int32 timeout, System.Boolean& replicationDelegateYieldedBeforeCompletion) [0x001f1] in <0242286efc4a47b69b5a84e828f56ef8>:0 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   at System.Threading.Tasks.TaskReplicator+Replica`1[TState].ExecuteAction (System.Boolean& yieldedBeforeCompletion) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/external/corefx/src/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/TaskReplicator.cs:123 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2246,3): error :   at System.Threading.Tasks.TaskReplicator+Replica.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/external/corefx/src/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/TaskReplicator.cs:78 
    7 Warning(s)
    1 Error(s)

Time Elapsed 00:00:18.87

---------------------- Done ----------------------

Build: 1 error, 7 warnings

Mainfest.xml

The manifest uses a "normal" build number and version.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1.0" android:versionName="1.0" package="ZeroPKI.WebOfTrust">
    <uses-sdk android:minSdkVersion="24" android:targetSdkVersion="27" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application android:label="WebOfTrust Preview" android:icon="@mipmap/ic_launcher"></application>
</manifest>
2 Answers

You need to change android:versionCode="1.0" in Mainfest.xml file to

android:versionCode="1"

It only accepts int and 1.0 would not be an int. and in versionName you can put incremented versions like 1.1 , 1.2, 1.3 and so on as this accepts string

I had the same issue.

In my case it was different, I was designing a RelativeLayout, and mistakenly I assigned the Factor of one of the views as text instead of an integer.

Strangely Xamarin compiler was not able to figure out which line has the issue, it was pointing at the top of the view.

This could happen for any Xaml value which should accept an integer and you are assigning it with different values.

Related