Cannot Build with IL2CPP

-1

I am trying to build APK or App Bundle with IL2CPP but I when build, the build process goes to "Building native binary with IL2CPP" then it stops and I get the following error:

Failed running D:\Program Files\Unity Versions\2019.1.0f2\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:\Workspace\UnitySandbox\EMIAPTest\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a\libil2cpp.so" --cachedirectory="D:\Workspace\UnitySandbox\EMIAPTest\Assets\..\Library\il2cpp_android_armeabi-v7a/il2cpp_cache" --additional-include-directories="D:\Program Files\Unity Versions\2019.1.0f2\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\bdwgc/include" --additional-include-directories="D:\Program Files\Unity Versions\2019.1.0f2\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\libil2cpp/include" --tool-chain-path="D:/Program Files/Unity Versions/2019.1.0f2/Editor/Data/PlaybackEngines/AndroidPlayer/NDK" --profiler-report --map-file-parser="D:/Program Files/Unity Versions/2019.1.0f2/Editor/Data/Tools/MapFileParser/MapFileParser.exe" --directory=D:/Workspace/UnitySandbox/EMIAPTest/Temp/StagingArea/assets/bin/Data/Managed --generatedcppdir=D:/Workspace/UnitySandbox/EMIAPTest/Temp/StagingArea/Il2Cpp/il2cppOutput

stdout:

Building libil2cpp.so with AndroidToolChain

    Output directory: D:\Workspace\UnitySandbox\EMIAPTest\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a

    Cache directory: D:\Workspace\UnitySandbox\EMIAPTest\Library\il2cpp_android_armeabi-v7a\il2cpp_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.<RunWithResult>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.<RunWithResult>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.<RunWithResult>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.<RunWithResult>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.<RunWithResult>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.<RunWithResult>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.<RunWithResult>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.<RunWithResult>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.<RunWithResult>b__0(Object o)<---



stderr:



Unhandled 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.<RunWithResult>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: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:496)
UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(String, String, String, Boolean) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:477)
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)

And this error right after it:

Exception: D:\Program Files\Unity Versions\2019.1.0f2\Editor\Data\il2cpp/build/il2cpp.exe did not run properly!
UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:130)
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action`1[T] setupStartInfo) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:73)
UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List`1[T] arguments, System.Action`1[T] setupStartInfo, System.String workingDirectory) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:496)
UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (System.String inputDirectory, System.String outputDirectory, System.String workingDirectory, System.Boolean platformSupportsManagedDebugging) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:477)
UnityEditorInternal.IL2CPPBuilder.Run () (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:334)
UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action`1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:63)
UnityEditor.Android.PostProcessor.Tasks.RunIl2Cpp.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <177bc8179be6497489c4b5b319f290d7>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:281)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Then I get usual "Build Failed" error.

I am running Unity 2019.1.0f2. Building APK or App Bundle on Mono works fine.

unity3d
asked on Stack Overflow Jul 29, 2019 by Petro Koval

2 Answers

0

Solved! I tried Unity 2019.1.11f1 and it worked with the new version!

p.s. Hope it will help someone one day :)

answered on Stack Overflow Jul 29, 2019 by Petro Koval
0

Also make sure you select the drop down in the < android part and select the ndk install. Because if you do not, you will get the same error because it will be using the old 16b version of ndk, and It WILL not let you upgrade to the new version manually in preferences. I had this problem and I just got the compile to finish with no errors and after 2 days. Finally fixed.

answered on Stack Overflow Jan 21, 2020 by xac

User contributions licensed under CC BY-SA 3.0