First make sure that you have no letters besides A-Z and 0-9 in your paths. That always causes problems.
Other than that,
How to troubleshoot build failures:
First, make a blank project with a single blank scene and prove that it builds successfully.
If the blank project does NOT build, go fix your Unity installation or your other tools, such as Android SDK, NDK, JDK, etc. It may even be necessary to change to a different version of Unity3D. It is generally best to stay with LTS versions of Unity3D.
Until you can build a blank project to the target platform, don’t fiddle with anything else.
Once you can build a blank project, now bisect the problem by bringing over parts of your current project and building it one subsystem at a time, perhaps stubbing things out that might trigger compiler errors.
Most often things that prevent building are third-party libraries such as Firebase.
Once you identify the subsystem, go to the documentation for it and make sure you are doing it correctly.
It may also be helpful to work through a tutorial or two for whatever subsystem is making the build fail.
Android build not building:
Recently (circa July 2022) there have been reports of Unity’s installer failing to install the Android Tools.
Here was how I brought up Unity2020.3.41 and the Android SDK 31 on October 30, 2022:
Hello, thank you very much for replying. You said create an empty project. I get 4 error messages when I create an empty project. Despite these errors, it gives a red error when I create it. I tried deleting everything related to Unity then reinstalling it but still getting the same errors.
i have the same too Internal build system error. read the full binlog without getting a BuildFinishedMessage, while the backend process is still running
I had the same problem with a simple project (on the Mac) - close the project (closed Unity, though the Hub was still open), I deleted the library folder within my project folder, I reopened the project from the Hub and selected ‘build’ again, worked a charm.
For me, deleting the Library Folder was not enough. What fixed it was installing all Modules available to the engine.
First i only installed Relevant Modules (WIndows Universal Build Support and ILL2CPP). But only after installing Mac and Android Build support, the error was fixed on all Projects.
Which is weird, as i am not even using those.
Only after that i deleted the library folder, and the project opened again.
Also make sure, you do not have the project or the Unity installation on a seperate hard drive. This can screw up permissions and this error pops up.
lost track of how many times I’ve had to delete library folder today to solve the issues that are this editor that has more bugs than the amazon rainforest. unity is finished.