Xamarin Forms error

Asked

Viewed 413 times

1

Good afternoon Personal,

I am trying to compile my project in Xamarin Forms and this giving error:

Gravidade   Código  Descrição   Projeto Arquivo Linha   Estado de Supressão
Erro        ***Falha inesperada da tarefa "Aapt".***
System.AggregateException: Um ou mais erros. ---> System.FormatException: A cadeia de caracteres de entrada não estava em um formato correto.
   em System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   em System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   em Xamarin.Android.Tasks.ManifestDocument.CalculateVersionCode(String currentAbi, String versionCodePattern, String versionCodeProperties)
   em Xamarin.Android.Tasks.Aapt.GenerateCommandLineCommands(String ManifestFile, String currentAbi, String currentResourceOutputFile)
   em Xamarin.Android.Tasks.Aapt.DoExecute(ITaskItem manifestFile, ParallelLoopState state, Int32 loop)
   em System.Threading.Tasks.Parallel.<>c__DisplayClass30_0`2.<ForEachWorker>b__3(Int32 i, ParallelLoopState state, TLocal local)
   em System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
   em System.Threading.Tasks.Task.InnerInvoke()
   em System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   em System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )
   --- Fim do rastreamento de pilha de exceções internas ---
   em System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   em System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   em System.Threading.Tasks.Task.Wait()
   em System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
   em System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](TSource[] array, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
   em System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
   em System.Threading.Tasks.Parallel.ForEach[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Func`1 localInit, Func`4 body, Action`1 localFinally)
   em Xamarin.Android.Tasks.Aapt.Execute()
   em Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   em Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
---> (Exceção Interna N° 0) System.FormatException: A cadeia de caracteres de entrada não estava em um formato correto.
   em System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   em System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   em Xamarin.Android.Tasks.ManifestDocument.CalculateVersionCode(String currentAbi, String versionCodePattern, String versionCodeProperties)
   em Xamarin.Android.Tasks.Aapt.GenerateCommandLineCommands(String ManifestFile, String currentAbi, String currentResourceOutputFile)
   em Xamarin.Android.Tasks.Aapt.DoExecute(ITaskItem manifestFile, ParallelLoopState state, Int32 loop)
   em System.Threading.Tasks.Parallel.<>c__DisplayClass30_0`2.<ForEachWorker>b__3(Int32 i, ParallelLoopState state, TLocal local)
   em System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
   em System.Threading.Tasks.Task.InnerInvoke()
   em System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   em System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )<---  AppRDVAUX.Android

Someone could help me solve?

@edit

2>    AdditionalAndroidResourcePaths:  (TaskId:495)

2> Libraryprojectjars: (Taskid:495) 2> Extraargs: --no-version-Vectors (Taskid:495) 2> Createpackageperabi: False (Taskid:495) 2> ResourceNameCaseMap: layout\Tabbar.axml|layout\tabbar.xml;layout\Toolbar.axml|layout\toolbar.xml;drawable\LogoAntigoAraguaina.png|drawable\logoantigoaraguaina.png;drawable\DevByAcesso.png|drawable\devbyacesso.png;drawable\IconAraguaina.png|drawable\iconaraguaina.png;drawable Araguaina240360.jpg|drawable araguaina240360.jpg; (Taskid:495) 2> Versioncodepattern: {Abi}{versionCode:D5} (Taskid:495) 2> Versioncodeproperties: (Taskid:495) 2>C: Program Files (x86) Microsoft Visual Studio 2017 Enterprise Msbuild Xamarin Android Xamarin.Android.Common.targets(1942,3): error MSB4018: Unexpected "Aapt" task failure. 2>C: Program Files (x86) Microsoft Visual Studio 2017 Enterprise Msbuild Xamarin Android Xamarin.Android.Common.targets(1942,3): error MSB4018: System.Aggregateexception: One or more errors. ---> System.Formatexception: The input string was not in a correct format.

  • Check the version of Java, Android SDK, Windows and Visual Studio.

  • Hello Tony, Android sdk is 25, Java is 8, windows 10 and visual studio 2017. My application was running smoothly, so I put an image in it (image without special characters) and it kept compiling, only out of the blue it started to give this error. I saw in another topic a guy teaching to pick up the bug in more detail, I will edit the post and put what I found.

  • Is it something related to format / options used when was generated this PNG file ? You tested with another file ?

  • I haven’t tested with another file yet, I’ll try.

  • Deletes all files (resoucers) from my project and compiled again, continues the same error.

  • You must have changed the properties of the android project. Specifically the field Version Number, must be with invalid content, which cannot convert to numeric. I think his intention was to change the Version Name. Take a look there.

  • Hello, it was exactly that, after searching enough just changed the version number in Android Manifest, recompiled and ended the error.

  • @Q.Wesley Beauty. I have recorded as a response to posterity =)

Show 3 more comments

1 answer

0


I believe the mistake is not related to the Java version, SDK or its image features as suggested in the comments...

You must have changed the properties of the android project. Specifically the field Version Number must have invalid content, which cannot be converted to numeric.

System.Aggregateexception: One or more errors. --> System.Formatexception: Input string was not in a correct format. ... in Xamarin.Android.Tasks.Manifestdocument.Calculateversioncode(String currentAbi, String versionCodePattern, String versionCodeProperties)

I think his intention was to alter the Version Name.

Give a check there on the project properties or on manifest and fix that which re-compiles.

I hope this helps.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.