Android building process gets stuck on "Building native binary with IL2CPP"
When building on Android with IL2CPP enabled, the building process gets stuck on "Building native binary with IL2CPP". It stays stuck for more than two hours, I then have to kill Unity through the task manager. While it's stuck, the CPU usage of Unity is at 0%.
Restarting Unity and the machine doesn't solve it. I tried deleting the Library folder in the project files, and got it to work 2 times like that, but now even this doesn't fix the problem. Also, deleting the "Il2cppBuildCache" folder in the Library folder after killing Unity makes the file explorer stop responding, restarting it in the task manager just makes the process stop working, which kind of breaks everything in Windows. I then have to force shut down the machine and restart it.
This bug occurred on 2 different Windows 10 machines on every version since Unity 2020.2. If building works once by magic, it immediately stops working afterwards. I even tried on an old project I haven't changed anything on for some time, and the same bug occurred. Rolling back to 2020.1 solves the problem, but I really like the features of the newer versions.
When the problem happens, can you use Process Explorer (https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer) to look at the processes as a tree? Although Unity it not doing anything at this moment, it is likely running a sub-process (probably the C++ compiler or linker from the Android NDK). I'd be curious to know what that process is and what its command line arguments are.
These are the processes in the task manager at the time where it's stuck:
And this is the Process Explorer:
This time, I have let it run for nearly 7 hours, and it's currently still stuck, so I don't think it's just a waiting thing.
Sorry, I cannot see the image attachments.
Answer by MaartenB · Mar 04, 2021 at 11:18 PM
@JoshPeterson I can confirm that I'm having the same issue here. Hereby an image of my process tree.
This is quite interesting though. Nothing is wrong when I'm using Unity Cloud Build. I don't know why, but it is grinding my gears.
Can you submit a bug report as well? The more examples we have of this, the better chance we have to track down its cause.
Answer by ClovyGames · Oct 11, 2021 at 12:10 PM
If you are using Bitdefender, it could go wrong. Try disabling Bitdefender and delete the Il2cppBuildCache file in the library file. ex) C:\UnityProjects\UnityProject\Library\Il2cppBuildCache.
Eventhough you are not using Bitdefender, you could try deleting the Il2cppBuildCache file. I hope this helps :D
Your answer
Follow this Question
Related Questions
Can't Build with IL2CPP for Android after 2018.3.0 Update(Empty Project) 1 Answer
Assertion Fail in elf32-arm.c:7827 when building for Android with IL2CPP 1 Answer
Android app not building after switching to il2cpp 0 Answers
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors 0 Answers
getting stuck at build with Il2cpp.exe, crashing everytime 0 Answers