Xamarin.Android错误-'指定的可执行文件不是此OS平台的有效应用程序' [英] Xamarin.Android error - 'The specified executable is not a valid application for this OS platform'

查看:255
本文介绍了Xamarin.Android错误-'指定的可执行文件不是此OS平台的有效应用程序'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找解决方案,但无济于事.我正在尝试构建Xamarin.Android项目,但我不断收到下面详述的错误.我正在Windows 10中运行Visual Studio 2017社区版.编译器输出:

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:

严重性代码描述项目文件行抑制状态错误"Aapt"任务意外失败.System.AggregateException:发生一个或多个错误.--->System.ComponentModel.Win32Exception:指定的可执行文件不是此OS平台的有效应用程序.在System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfostartInfo)位于System.Diagnostics.Process.Start()处Xamarin.Android.Tasks.Aapt.RunAapt(String命令行)位于Xamarin.Android.Tasks.Aapt.ExecuteForAbi(String cmd,字符串currentResourceOutputFile)Xamarin.Android.Tasks.Aapt.DoExecute(ITaskItem manifestFile,ParallelLoopState状态,在Int32循环中)System.Threading.Tasks.Parallel.<> c__DisplayClass30_02.b__3(Int32i,ParallelLoopState状态,TLocal本地)位于System.Threading.Tasks.Parallel.<> c__DisplayClass17_01.b__1()在System.Threading.Tasks.Task.InnerInvoke()在System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)位于System.Threading.Tasks.Task.<> c__DisplayClass176_0.b__0(Object)---内部异常堆栈跟踪的结尾---System.Threading.Tasks.Task.ThrowIfExceptional(BooleanincludeTaskCanceledExceptions)System.Threading.Tasks.Task.Wait(Int32毫秒超时,的CancellationToken cancelToken()System.Threading.Tasks.Task.Wait()在System.Threading.Tasks.Parallel.ForWorker [TLocal](Int32 fromInclusive,Int32 toExclusive,ParallelOptions parallelOptions,Action 1主体,动作2 bodyWithState,函数4 bodyWithLocal,函数1 localInit,行动1(最后一次)在System.Threading.Tasks.Parallel.ForEachWorker [TSource,TLocal](TSource []数组,ParallelOptions parallelOptions,动作1主体,动作2bodyWithState,动作3 bodyWithStateAndIndex,功能4bodyWithStateAndLocal,功能5 bodyWithEverything,功能1 localInit,行动1(最后一次)在System.Threading.Tasks.Parallel.ForEachWorker [TSource,TLocal](IEnumerable 1源,ParallelOptions parallelOptions,动作1主体,动作2bodyWithState,动作3 bodyWithStateAndIndex,功能4bodyWithStateAndLocal,功能5 bodyWithEverything,功能1 localInit,行动1(最后一次)在System.Threading.Tasks.Parallel.ForEach [TSource,TLocal](IEnumerable1源代码,Func1 localInit,Func 4主体,Action1 localFinally)位于Xamarin.Android.Tasks.Aapt.Execute()在Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()在Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()--->(内部异常#0)System.ComponentModel.Win32Exception(0x80004005):指定的可执行文件不是有效的应用程序此OS平台.在System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfostartInfo)位于System.Diagnostics.Process.Start()处Xamarin.Android.Tasks.Aapt.RunAapt(String命令行)位于Xamarin.Android.Tasks.Aapt.ExecuteForAbi(String cmd,字符串currentResourceOutputFile)Xamarin.Android.Tasks.Aapt.DoExecute(ITaskItem manifestFile,ParallelLoopState状态,在Int32循环中)System.Threading.Tasks.Parallel.<> c__DisplayClass30_02.b__3(Int32i,ParallelLoopState状态,TLocal本地)位于System.Threading.Tasks.Parallel.<> c__DisplayClass17_01.b__1()在System.Threading.Tasks.Task.InnerInvoke()在System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)位于System.Threading.Tasks.Task.<> c__DisplayClass176_0.b__0(Object)< --- LetsLend.Android

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

推荐答案

"Aapt"任务失败

"Aapt" task failed

System.ComponentModel.Win32Exception:指定的可执行文件不是此OS平台的有效应用程序.

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

检查是否已安装有效/未损坏的Android SDK aapt.exe / aapt .

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

1)找到Visual Studio使用的Android SDK根目录位置:

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

  • Mac:

  • Windows:

打开一个外壳,然后 cd 进入您的Android SDK根目录,并尝试手动执行 aapt.exe / aapt .

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

注意:它将位于子目录 build-tools \ XX.XX 中(当前 XX.XX 将是 27.0.0 如果您的SDK是最新版本)

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)

如果 aapt 有效,则将输出其所有用法选项,否则打开Android SDK Manager并卸载/重新安装最新版本的 Build Tools

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

这篇关于Xamarin.Android错误-'指定的可执行文件不是此OS平台的有效应用程序'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆