报错如下:
Failed running D:\unity2018\Unity\Editor\Data\il2cpp/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:\unity2018project\New Unity Project (3)\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a\libil2cpp.so" --cachedirectory="D:\unity2018project\New Unity Project (3)\Assets\..\Library\il2cpp_android_armeabi-v7a/il2cpp_cache" --additional-include-directories="D:\unity2018\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\bdwgc/include" --additional-include-directories="D:\unity2018\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\libil2cpp/include" --tool-chain-path="D:/Android/android-ndk-r16b-windows-x86/android-ndk-r16b" --map-file-parser="D:\unity2018\Unity\Editor\Data\Tools\MapFileParser\MapFileParser.exe" --directory="D:\unity2018project\New Unity Project (3)\Temp\StagingArea\assets\bin\Data\Managed" --generatedcppdir="D:\unity2018project\New Unity Project (3)\Temp\StagingArea\Il2Cpp\il2cppOutput"
stdout:
Building libil2cpp.so with AndroidToolChain
Output directory: D:\unity2018project\New Unity Project (3)\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a
Cache directory: D:\unity2018project\New Unity Project (3)\Library\il2cpp_android_armeabi-v7a\il2cpp_cache
il2cpp.exe didn't catch exception: System.AggregateException: ����һ���������� ---> System.ComponentModel.Win32Exception: ϵͳ�Ҳ���ָ�����ļ���
�� System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
�� Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
�� Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
�� Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)
--- �ڲ��쳣��ջ���ٵĽ�β ---
�� Unity.IL2CPP.Building.ParallelFor.RunWithResult[D,T](D[] data, Func`2 action)
�� Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable`1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector)
�� Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
�� il2cpp.Program.DoRun(String[] args)
�� il2cpp.Program.Run(String[] args)
�� il2cpp.Program.Main(String[] args)
---> (�ڲ��쳣 #0) System.ComponentModel.Win32Exception (0x80004005): ϵͳ�Ҳ���ָ�����ļ���
�� System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
�� Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
�� Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
�� Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---
---> (�ڲ��쳣 #1) System.ComponentModel.Win32Exception (0x80004005): ϵͳ�Ҳ���ָ�����ļ���
�� System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
�� Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
�� Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
�� Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---
---> (�ڲ��쳣 #2) System.ComponentModel.Win32Exception (0x80004005): ϵͳ�Ҳ���ָ�����ļ���
�� System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
�� Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
�� Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
�� Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---
---> (�ڲ��쳣 #3) System.ComponentModel.Win32Exception (0x80004005): ϵͳ�Ҳ���ָ�����ļ���
�� System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
�� Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
�� Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
�� Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---
---> (�ڲ��쳣 #4) System.ComponentModel.Win32Exception (0x80004005): ϵͳ�Ҳ���ָ�����ļ���
�� System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
�� Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
�� Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
�� Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---
---> (�ڲ��쳣 #5) System.ComponentModel.Win32Exception (0x80004005): ϵͳ�Ҳ���ָ�����ļ���
�� System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
�� Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
�� Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
�� Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---
---> (�ڲ��쳣 #6) System.ComponentModel.Win32Exception (0x80004005): ϵͳ�Ҳ���ָ�����ļ���
�� System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
�� Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
�� Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
�� Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---
---> (�ڲ��쳣 #7) System.ComponentModel.Win32Exception (0x80004005): ϵͳ�Ҳ���ָ�����ļ���
�� System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
�� Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
�� Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
�� Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---
stderr:
δ��������쳣: System.AggregateException: ����һ���������� ---> System.ComponentModel.Win32Exception: ϵͳ�Ҳ���ָ�����ļ���
�� System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
�� Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)
�� Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)
�� Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)
--- �ڲ��쳣��ջ���ٵĽ�β ---
�� Unity.IL2CPP.Building.ParallelFor.RunWithResult[D,T](D[] data, Func`2 action)
�� Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable`1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector)
�� Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
�� il2cpp.Program.DoRun(String[] args)
�� il2cpp.Program.Run(String[] args)
�� 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:128)
UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase, Action`1) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:73)
UnityEditorInternal.IL2CPPBuilder:RunIl2CppWithArguments(List`1, Action`1, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:368)
UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(String, String, String, Boolean) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:349)
UnityEditorInternal.IL2CPPBuilder:Run() (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:211)
UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, String, IIl2CppPlatformProvider, Action`1, RuntimeClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:35)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
原因是我用了unity自带下载的ndk导致 重新下载个即可
android-ndk-r16b-windows-x86(自动下载的)
android-ndk-r16b-windows-x86_64(手动下载的)
下载后unity->edit->preferences->external tools->ndk设置