简体   繁体   English

Xamarin.forms中的输入字符串格式不正确

[英]Input string was not in correct format error in Xamarin.forms

I have a text editor app that has multiple pages in Xamarin.forms but when trying to build or run it I get this error: 我有一个文本编辑器应用程序,该应用程序在Xamarin.forms中具有多个页面,但是在尝试构建或运行它时出现此错误:

Input string was not in a correct format.
   at System.Number.StringToNumber(String       str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at Xamarin.Android.Tasks.ManifestDocument.CalculateVersionCode(String currentAbi, String versionCodePattern, String versionCodeProperties)
   at Xamarin.Android.Tasks.Aapt.GenerateCommandLineCommands(String ManifestFile, String currentAbi, String currentResourceOutputFile)
   at Xamarin.Android.Tasks.Aapt.ProcessManifest(ITaskItem manifestFile)
   at System.Threading.Tasks.Parallel.<>c__DisplayClass30_0`2.<ForEachWorker>b__0(Int32 i)
   at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )

It does not give me the location of the error,it just tells me that it is in the solution and I'm not entirely sure how i could fix the error, or even find where it is. 它没有告诉我错误的位置,它只是告诉我它在解决方案中,我不完全确定如何解决错误,甚至找不到错误的位置。

I made the app in Xamarin.forms and is a text editor with an interface allowing you to save and delete your pieces of code. 我在Xamarin.forms制作了该应用程序,并且是一个带有界面的文本编辑器,允许您保存和删除代码段。

And help with finding the error or even better solving it would be really appreciated. 并非常感谢您发现错误或更好地解决错误。 Sorry for the lack of included code as there is a lot, and I don't actually know the location of the error so I wouldn't know what to show. 抱歉,由于缺少很多代码,我实际上不知道错误的位置,所以我不知道显示什么。 Thanks! 谢谢!

将Mainfest.xml文件中的android:versionCode =“ 1.0”更改为android:versionCode =“ 1”

You need to check if the value of android:versionCode in your Mainfest.xml file could been parsed into an integer value . 您需要检查Mainfest.xml文件中android:versionCode的值是否可以解析为整数值。

From Set application version information , we will see 从“ 设置应用程序版本信息”中 ,我们将看到

versionCode — A positive integer used as an internal version number. versionCode —一个正整数,用作内部版本号。 This number is used only to determine whether one version is more recent than another, with higher numbers indicating more recent versions. 该数字仅用于确定一个版本是否比另一个版本新,而更高的数字则表示最新版本。 This is not the version number shown to users; 这不是显示给用户的版本号; that number is set by the versionName setting, below. 该数字由下面的versionName设置设置。 The Android system uses the versionCode value to protect against downgrades by preventing users from installing an APK with a lower versionCode than the version currently installed on their device. Android系统使用versionCode值来防止用户安装版本码比其设备上当前安装的版本低的APK,以防止降级。 The value is a positive integer so that other apps can programmatically evaluate it, for example to check an upgrade or downgrade relationship. 该值是一个正整数,以便其他应用可以以编程方式评估它,例如检查升级或降级关系。 You can set the value to any positive integer you want, however you should make sure that each successive release of your app uses a greater value. 您可以将值设置为所需的任何正整数,但是应确保应用程序的每个后续发行版均使用更大的值。 You cannot upload an APK to the Play Store with a versionCode you have already used for a previous version. 您不能将带有先前版本已使用的versionCode的APK上传到Play商店。

Typically, you would release the first version of your app with versionCode set to 1, then monotonically increase the value with each release, regardless of whether the release constitutes a major or minor release. 通常,您会发布版本为1的应用程序的第一个版本,然后在每个版本中单调增加该值,而不考虑该版本是主要版本还是次要版本。 This means that the versionCode value does not necessarily have a strong resemblance to the app release version that is visible to the user (see versionName, below). 这意味着versionCode值不一定与用户可见的应用程序发行版本非常相似(请参见下面的versionName)。 Apps and publishing services should not display this version value to users. 应用和发布服务不应向用户显示此版本值。

Warning: The greatest value Google Play allows for versionCode is 2100000000. 警告:Google Play允许versionCode的最大值是2100000000。

versionName — A string used as the version number shown to users. versionName —用作显示给用户的版本号的字符串。 This setting can be specified as a raw string or as a reference to a string resource. 该设置可以指定为原始字符串或对字符串资源的引用。 The value is a string so that you can describe the app version as a .. string, or as any other type of absolute or relative version identifier. 该值是一个字符串,以便您可以将应用程序版本描述为..字符串或任何其他类型的绝对或相对版本标识符。 The versionName has no purpose other than to be displayed to users. 除了向用户显示之外,versionName没有其他用途。

So, the versionCode ( or Version number ) should be a positive integer, which is an internal version number. 因此, versionCode (或Version number )应为正整数,这是内部版本号。 And , the Version name in releases can be set what you want as long as it's a string,(eg 2.022.ddd.kkkk) . 并且,可以根据需要设置发布中的Version名称,只要它是字符串即可(例如2.022.ddd.kkkk)。 Of course, We should set the proper version information to make it easier for users to understand. 当然,我们应该设置适当的版本信息,以使用户更容易理解。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM