Xamarin.Android error - 'The specified executable is not a valid application for this OS platform'

僤鯓⒐⒋嵵緔 提交于 2020-02-05 05:37:17

问题


I have searched for a solution, to no avail. I am trying to build a Xamarin.Android project but i keep getting the error detailed below. I Am running Visual Studio 2017 Community Edition in Windows 10. Compiler Output:

Severity Code Description Project File Line Suppression State Error The "Aapt" task failed unexpectedly. System.AggregateException: One or more errors occurred. ---> System.ComponentModel.Win32Exception: The specified executable is not a valid application for this OS platform. at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at Xamarin.Android.Tasks.Aapt.RunAapt(String commandLine) at Xamarin.Android.Tasks.Aapt.ExecuteForAbi(String cmd, String currentResourceOutputFile) at Xamarin.Android.Tasks.Aapt.DoExecute(ITaskItem manifestFile, ParallelLoopState state, Int32 loop) at System.Threading.Tasks.Parallel.<>c__DisplayClass30_02.b__3(Int32 i, ParallelLoopState state, TLocal local) at System.Threading.Tasks.Parallel.<>c__DisplayClass17_01.b__1() at System.Threading.Tasks.Task.InnerInvoke() at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) at System.Threading.Tasks.Task.<>c__DisplayClass176_0.b__0(Object ) --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait() at 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) at 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) at 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) at System.Threading.Tasks.Parallel.ForEach[TSource,TLocal](IEnumerable1 source, Func1 localInit, Func 4 body, Action1 localFinally) at Xamarin.Android.Tasks.Aapt.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() ---> (Inner Exception #0) System.ComponentModel.Win32Exception (0x80004005): The specified executable is not a valid application for this OS platform. at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at Xamarin.Android.Tasks.Aapt.RunAapt(String commandLine) at Xamarin.Android.Tasks.Aapt.ExecuteForAbi(String cmd, String currentResourceOutputFile) at Xamarin.Android.Tasks.Aapt.DoExecute(ITaskItem manifestFile, ParallelLoopState state, Int32 loop) at System.Threading.Tasks.Parallel.<>c__DisplayClass30_02.b__3(Int32 i, ParallelLoopState state, TLocal local) at System.Threading.Tasks.Parallel.<>c__DisplayClass17_01.b__1() at System.Threading.Tasks.Task.InnerInvoke() at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) at System.Threading.Tasks.Task.<>c__DisplayClass176_0.b__0(Object )<--- LetsLend.Android


回答1:


"Aapt" task failed

System.ComponentModel.Win32Exception: The specified executable is not a valid application for this OS platform.

Check if you have a valid/non-corrupted Android SDK aapt.exe / aapt installed.

1) Locate the Android SDK root directory location that Visual Studio is using:

  • Mac:

  • Windows:

Open a shell and cd into your root Android SDK directory and try manually executing aapt.exe / aapt.

Note: It will be located within in a subdirectory build-tools\XX.X.X (Currenty XX.X.X will be 27.0.0 if your SDK is update to date)

If aapt is valid it will output all of its usages options, otherwise open the Android SDK Manager and uninstall / re-install the latest version of the Build Tools



来源:https://stackoverflow.com/questions/47064105/xamarin-android-error-the-specified-executable-is-not-a-valid-application-for

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!