在最后几步为Android失败构建一个Unity项目,我在控制台中得到了什么:
Failed running C:Program FilesUnityHubEditor2019.2.4f1EditorDatail2cpp/build/il2cpp.exe
...
il2cpp.exe didn't catch exception: System.AggregateException: One or more errors occurred. --->System.ComponentModel.Win32Exception:
The specified executable is not a valid application for this OS platform.
如何理解出了什么问题并加以解决?
完整错误文本:
Failed running C:Program FilesUnityHubEditor2019.2.4f1EditorDatail2cpp/build/il2cpp.exe --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile="unityaot" --compile-cpp --libil2cpp-static --platform="Android" --architecture="ARMv7" --configuration="Release" --outputpath="D:ProjectsUnity3dMyGameTempStagingAreaassetsbinDataNativearmeabi-v7alibil2cpp.so" --cachedirectory="D:ProjectsUnity3dMyGameAssets..Libraryil2cpp_android_armeabi-v7a/il2cpp_cache" --additional-include-directories="C:/Program Files/Unity/Hub/Editor/2019.2.4f1/Editor/Data/PlaybackEngines/AndroidPlayer/Toolsbdwgc/include" --additional-include-directories="C:/Program Files/Unity/Hub/Editor/2019.2.4f1/Editor/Data/PlaybackEngines/AndroidPlayer/Toolslibil2cpp/include" --tool-chain-path="C:/Program Files/Unity/Hub/Editor/2019.2.4f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK" --profiler-report --map-file-parser="C:/Program Files/Unity/Hub/Editor/2019.2.4f1/Editor/Data/Tools/MapFileParser/MapFileParser.exe" --directory=D:/Projects/Unity3d/MyGame/Temp/StagingArea/assets/bin/Data/Managed --generatedcppdir=D:/Projects/Unity3d/MyGame/Temp/StagingArea/Il2Cpp/il2cppOutput
stdout:
Building libil2cpp.so with AndroidToolChain
Output directory: D:ProjectsUnity3dMyGameTempStagingAreaassetsbinDataNativearmeabi-v7a
Cache directory: D:ProjectsUnity3dMyGameLibraryil2cpp_android_armeabi-v7ail2cpp_cache
il2cpp.exe didn't catch exception: 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 Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
at Unity.IL2CPP.Building.ParallelFor.c__DisplayClass1_0`2.b__0(Object o)
--- End of inner exception stack trace ---
at Unity.IL2CPP.Building.ParallelFor.RunWithResult[D,T](D[] data, Func`2 action)
at Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable`1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector)
at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
at il2cpp.Program.DoRun(String[] args)
at il2cpp.Program.Run(String[] args)
at il2cpp.Program.Main(String[] args)
--->(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 Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
at Unity.IL2CPP.Building.ParallelFor.c__DisplayClass1_0`2.b__0(Object o) (Inner Exception #1) System.ComponentModel.Win32Exception (0x80004005): The specified executable is not a valid application for this OS platform.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
at Unity.IL2CPP.Building.ParallelFor.c__DisplayClass1_0`2.b__0(Object o) (Inner Exception #2) System.ComponentModel.Win32Exception (0x80004005): The specified executable is not a valid application for this OS platform.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
at Unity.IL2CPP.Building.ParallelFor.c__DisplayClass1_0`2.b__0(Object o) (Inner Exception #3) System.ComponentModel.Win32Exception (0x80004005): The specified executable is not a valid application for this OS platform.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
at Unity.IL2CPP.Building.ParallelFor.c__DisplayClass1_0`2.b__0(Object o) (Inner Exception #4) System.ComponentModel.Win32Exception (0x80004005): The specified executable is not a valid application for this OS platform.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
at Unity.IL2CPP.Building.ParallelFor.c__DisplayClass1_0`2.b__0(Object o) (Inner Exception #5) System.ComponentModel.Win32Exception (0x80004005): The specified executable is not a valid application for this OS platform.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
at Unity.IL2CPP.Building.ParallelFor.c__DisplayClass1_0`2.b__0(Object o) (Inner Exception #6) System.ComponentModel.Win32Exception (0x80004005): The specified executable is not a valid application for this OS platform.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
at Unity.IL2CPP.Building.ParallelFor.c__DisplayClass1_0`2.b__0(Object o) (Inner Exception #7) System.ComponentModel.Win32Exception (0x80004005): The specified executable is not a valid application for this OS platform.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
at Unity.IL2CPP.Building.ParallelFor.c__DisplayClass1_0`2.b__0(Object o) System.ComponentModel.Win32Exception: The specified executable is not a valid application for this OS platform.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
at Unity.IL2CPP.Building.ParallelFor.c__DisplayClass1_0`2.b__0(Object o)
--- End of inner exception stack trace ---
at Unity.IL2CPP.Building.ParallelFor.RunWithResult[D,T](D[] data, Func`2 action)
at Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable`1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector)
at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
at il2cpp.Program.DoRun(String[] args)
at il2cpp.Program.Run(String[] args)
at il2cpp.Program.Main(String[] args)
UnityEngine.Debug:LogError(Object)
UnityEditorInternal.Runner:RunProgram(Program, String, String, String, CompilerOutputParserBase) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:126)
UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase, Action`1) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:71)
UnityEditorInternal.IL2CPPBuilder:RunIl2CppWithArguments(List`1, Action`1, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:503)
UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(String, String, String, Boolean) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:484)
UnityEditorInternal.IL2CPPBuilder:Run() (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:334)
UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, String, IIl2CppPlatformProvider, Action`1, RuntimeClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:63)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
内置的unity ndk本身有缺陷,您需要从谷歌安卓开发者页面安装一个稳定版本:安卓ndk,修订版16b(2017年12月(。
我尝试安装/重新安装所有类型的android工具,Unity编辑器,Visual Studio(但我没有尝试重新安装Windows:(。最后,为了解决另一个问题,我尝试更改Edit -> Project Settings -> Player -> Other Settings -> Configuration -> Scripting Backed
,它将其从IL2CCP
更改为Mono
,并纠正了我的构建错误(构建过程变得更快(。
我仍然不知道为什么我是项目团队中唯一一个在选择IL2CCP
时必须处理这个问题的人,但至少现在我可以调试项目了。
如果你对和之间的区别感兴趣,这里有关于这个话题的好答案。