【发布时间】:2017-11-01 21:39:38
【问题描述】:
我一直在寻找解决方案,但无济于事。我正在尝试构建一个 Xamarin.Android 项目,但我不断收到下面详述的错误。我在 Windows 10 中运行 Visual Studio 2017 社区版。 编译器输出:
严重性代码描述项目文件行抑制状态 错误“Aapt”任务意外失败。 System.AggregateException: 发生一个或多个错误。 ---> System.ComponentModel.Win32Exception:指定的可执行文件不是 此操作系统平台的有效应用程序。在 System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) 在 System.Diagnostics.Process.Start() 在 Xamarin.Android.Tasks.Aapt.RunAapt(字符串命令行)在 Xamarin.Android.Tasks.Aapt.ExecuteForAbi(字符串 cmd,字符串 当前资源输出文件)在 Xamarin.Android.Tasks.Aapt.DoExecute(ITaskItem manifestFile, ParallelLoopState 状态,Int32 循环)在 System.Threading.Tasks.Parallel.c__DisplayClass30_02.b__3(Int32 i,ParallelLoopState 状态,TLocal 本地)在 System.Threading.Tasks.Parallel.c__DisplayClass17_01.b__1() 在 System.Threading.Tasks.Task.InnerInvoke() 在 System.Threading.Tasks.Task.InnerInvokeWithArg(任务子任务)在 System.Threading.Tasks.Task.c__DisplayClass176_0.b__0(对象 ) --- 内部异常堆栈跟踪结束 --- at System.Threading.Tasks.Task.ThrowIfExceptional(布尔 includeTaskCanceledExceptions) 在 System.Threading.Tasks.Task.Wait(Int32 毫秒超时, CancellationToken 取消令牌)在 System.Threading.Tasks.Task.Wait() 在 System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive、ParallelOptions、parallelOptions、Action 1 body、 动作 2 bodyWithState,Func 4 bodyWithLocal,Func 1 localInit, 行动 1 localFinally) 在 System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](TSource[] 数组,ParallelOptions 并行选项,动作 1 主体,动作 2 bodyWithState,动作 3 bodyWithStateAndIndex,Func 4 bodyWithStateAndLocal, Func 5 bodyWithEverything, Func 1 localInit, 行动 1 localFinally) 在 System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable 1 源,ParallelOptions 并行选项,动作 1 主体,动作 2 bodyWithState,动作 3 bodyWithStateAndIndex,Func 4 bodyWithStateAndLocal, Func 5 bodyWithEverything, Func 1 localInit, 行动 1 localFinally) 在 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() ---> (Inner Exception #0) System.ComponentModel.Win32Exception (0x80004005): 指定的可执行文件不是有效的应用程序 这个操作系统平台。在 System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) 在 System.Diagnostics.Process.Start() 在 Xamarin.Android.Tasks.Aapt.RunAapt(字符串命令行)在 Xamarin.Android.Tasks.Aapt.ExecuteForAbi(字符串 cmd,字符串 当前资源输出文件)在 Xamarin.Android.Tasks.Aapt.DoExecute(ITaskItem manifestFile, ParallelLoopState 状态,Int32 循环)在 System.Threading.Tasks.Parallel.c__DisplayClass30_02.b__3(Int32 i,ParallelLoopState 状态,TLocal 本地)在 System.Threading.Tasks.Parallel.c__DisplayClass17_01.b__1() 在 System.Threading.Tasks.Task.InnerInvoke() 在 System.Threading.Tasks.Task.InnerInvokeWithArg(任务子任务)在 System.Threading.Tasks.Task.c__DisplayClass176_0.b__0(对象 )
【问题讨论】:
-
您是否安装了有效/未损坏的 android-sdk?尝试在 cmd 行上手动执行
aapt.exe。它将位于您的 android SDK 安装位置的子目录build-tools\XX.X.X\aapt.exe中(如果您的 SDK 是最新更新,XX.X.X将是27.0.0) -
哇,这正是问题所在。我导航到“build-tools”子目录并意识到“aapt.exe”的大小为 0KB。我通过 Android SDK Manager 重新下载了构建工具,现在一切都很好。 (不确定如何将其标记为答案,但它就是答案)
-
我添加了这个作为答案 ;-) 很高兴它有帮助。
标签: android xamarin xamarin.android