简体   繁体   中英

Exception: IL2CPP.exe did not run properly! Unity 3D build issue

My unity version 2019.3.12f1 I have problem with build my Android game. When I want use IL2CPP, I can't build my game. In console is this errors:

Exception: C:\Program Files\Unity\Editor\Data\il2cpp/build/deploy/net471/il2cpp.exe did not run properly!

Exception: C:\Program Files\Unity\Editor\Data\il2cpp/build/deploy/net471/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 <ffcf2f9855fe46038192299154f37a45>:0)
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action`1[T] setupStartInfo) (at <ffcf2f9855fe46038192299154f37a45>:0)
UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List`1[T] arguments, System.Action`1[T] setupStartInfo, System.String workingDirectory) (at <ffcf2f9855fe46038192299154f37a45>:0)
UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data, System.String outputDirectory, System.String workingDirectory, System.Boolean platformSupportsManagedDebugging) (at <ffcf2f9855fe46038192299154f37a45>:0)
UnityEditorInternal.IL2CPPBuilder.Run () (at <ffcf2f9855fe46038192299154f37a45>:0)
UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action`1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at <ffcf2f9855fe46038192299154f37a45>:0)
UnityEditor.Android.PostProcessor.Tasks.RunIl2Cpp.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <3167064085404657b0d6c498207da025>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <3167064085404657b0d6c498207da025>: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 <3167064085404657b0d6c498207da025>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <3167064085404657b0d6c498207da025>: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 <ffcf2f9855fe46038192299154f37a45>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

How can I fix it?

When I use Mono, building is working. When I use ILC2PP, building is not working.

The problem is this Unity Assets Name has you in pic the name of folder is.." VacuumShaders" I removed these Assets my Project build Success in IL2CPP

在此处输入图像描述

在此处输入图像描述

Just thought I'd add that for me this error was caused by accidentally having the architecture in build settings as x86 instead of x86_64

I went through a whole process (over days) to figure out why this was happening and while the solution was "simple" I'm writing my whole process down in hopes that it will save developers valuable time.

  • Had to get a 64bit version of sqlite (using sqlite in this project)
  • Had to get a 64bit version of Newtonsoft.Json (to process json from the web)
  • Had to upgrade unity to a version that will build android64 with il2cpp SetLastWin32Error bug fix (anything after ~ 2021.2.11? Latest is 2021.2.15f1 as time of writing)

Still getting build errors so I

  • Created a brand new project and exported to android64 - success
  • Compared android settings between projects
  • Compared package settings between projects
  • Compared all preference settings between projects
  • Stripped my app down (in halves) down to nothing

Ultimately, and somewhat obviously, the issue was in my existing android app that unity was being exported into:

  • When built directly to apk (uncheck Export Project in Build Settings > Android) AND unchecked all the "Custom _" from Publishing Settings > Build is when the build stopped complaining of il2cpp build errors
  • I had to re-write my custom android implementation from scratch to find the culprits

I never found the specific problem but I assume it had to do with the unity base in my old custom app. My best advice is to start fresh with a clean 64 build build from android and then move your custom app over piece by piece.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM