简体   繁体   中英

I'm getting IL2CPP build error for some reason

For some reason, I'm getting build errors. I was be able to build my project clearly with mono. I'm trying to build the project with IL2CPP now and getting some errors.

I tried:

  • Changing Windows language to English. In fact, I reinstalled Windows 11.
  • And reinstall Unity, Visual Studio and sdk, ndk etc.

Btw, the error is about file path of compile.rsp file. I manually checked that file path and the file. it is exist in the right file location.

Here is the errors and console messages.

Error 1:

Internal build system error. BuildProgram exited with code -2147024893.
System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\Program Files\Unity\Hub\Editor\2021.2.7f1\Editor\Data\PlaybackEngines\AndroidPlayer\Variations\il2cpp\Release\StaticLibs\armeabi-v7a\compile.rsp'.
   at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
   at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
   at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks)
   at System.IO.File.InternalReadAllText(String path, Encoding encoding)
   at System.IO.File.ReadAllText(String path)
   at NiceIO.NPath.SystemIOFileSystem.File_ReadAllText(NPath path)
   at NiceIO.NPath.WindowsFileSystem.File_ReadAllText(NPath path)
   at Bee.Core.Stevedore.VirtualFileSystem.File_ReadAllText(NPath path)
   at NiceIO.NPath.RelayingFileSystem.File_ReadAllText(NPath path)
   at Bee.Core.BuildProgramFileSystem.File_ReadAllText(NPath path)
   at NiceIO.NPath.ReadAllText()
   at AndroidPlayerBuildProgram.AndroidPlayerBuildProgram.SetupCompile(AndroidSharedLibraryConfiguration config, String name, AndroidTargetDeviceType deviceType, NPath sourceFilePath)
   at AndroidPlayerBuildProgram.AndroidPlayerBuildProgram.SetupLibUnityLibrary()+MoveNext()
   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
   at System.Collections.Generic.List`1.AddRange(IEnumerable`1 collection)
   at AndroidPlayerBuildProgram.AndroidPlayerBuildProgram.SetupPlayerBuild()
   at PlayerBuildProgramLibrary.PlayerBuildProgramBase.RunBuildProgram()
   at PlayerBuildProgramTypeWrapper.Run(String[] args)
   at Program.Main(String[] args)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Error 2:

BuildFailedException: Incremental Player build failed!
UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <0cde216a590a4d6fbc3d7db7ac203c5d>:0)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <0cde216a590a4d6fbc3d7db7ac203c5d>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <374d68101b9e4829844c8329406f32cc>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, 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 <0cde216a590a4d6fbc3d7db7ac203c5d>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

I finally solved my problem.

2 things you must be sure

  1. Set your Windows Display Language to English
  2. Change your Unity version from 2021.2 to 2020.3

These 2 thing most probably solve your problem like mine

Hocam IL2CPP ile build almaya çalıştığım zaman tıpa tıp aynı hatayı veriyor, benim Unity versiyonum 2021.2.7f1 hangi versiyona düşürmeliyim veya düşürmeden çözmenin bir yolu var mıdır? İyi çalışmalar.

In case the answer presented doesn't help, I've found a different possible cause of the error - large arrays of values (over 10k elements) can't be handled by IL2CPP specifically. No clue why-how, it just was mentioned on a thread in Unity forum, and it did solve the problem for me - I just dropped all the values in the text file and parsed it on startup.

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