Xamarin.Android.Targets失败,错误为“输入字符串的格式不正确”。

时间:2018-09-04 02:07:50

标签: xamarin xamarin.forms xamarin.android xamarin-studio

下面的错误包含“输入字符串的格式不正确。”,我无法弄清楚是什么原因导致了此问题。

如有必要,我可以发布更完整的项目/日志。该项目在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

清单使用“正常”内部版本号和版本。

<?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 个答案:

答案 0 :(得分:4)

您需要将 Mainfest.xml 文件中的android:versionCode="1.0"更改为

android:versionCode="1"

它仅接受int,而1.0不是整数。并且在versionName中,您可以放置​​1.1、1.2、1.3等递增版本,以接受string

我有同样的问题。

答案 1 :(得分:0)

就我而言,情况有所不同,我正在设计一个RelativeLayout,并且错误地将其中一个视图的Factor分配为文本而不是整数。

奇怪的是,Xamarin编译器无法指出出现问题的那一行,它指向视图的顶部。

对于任何应该接受整数的Xaml值,您都可以为其分配不同的值,这可能会发生。