4 Errors on build, can't tell what they mean

Currently developing a VR game. Everything works fine in editor, but trying to build the game gives the following errors, and I have no idea how to go about fixing these.

UnityEditor.BuildPlayerWindow+BuildMethodException: 4 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in <50f55621a2ca4f31a35283e2979a8bf5>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <50f55621a2ca4f31a35283e2979a8bf5>:0
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

1 Like

This is a general error telling you that there were build failures, and how many. There should be some info in that log, or more log errors, that give you more information.

Is there no other error output in the console log? If you open the Editor log can you find any more information about this?

Thanks for the reply! Hereā€™s the only other things that are logged into console. I canā€™t find anywhere in my player prefab that has script errors
https://imgur.com/rV1V4C8

Its where you are storing the buildā€¦read/write accessible?

p-

Yes, it is. Changing the build location gives the same error.

Open the project. Start the project build. After the error appears, take the editor log file (Unity - Manual: Log files) and attach it to the topic.

Additionally, you can try to make an empty scene in this project. Select only it for the build and see if there will be the same problem.

I had same issue, but if I use just ā€œBuildā€ (not ā€œBuild And Runā€) the .exe is created and works fine

Exactly the same for us (the only difference is that we are building for mobile not for desktop)

Without the log, itā€™s really hard to narrow down whatā€™s failing. As @joejo and @str3lok pointed out, thereā€™s more information in the logs that should tell you more about whatā€™s going on/whatā€™s failed. Iā€™d start there.

same issue here, i try to make an android build its been years since i did that and with the new unity it seems like the tools are integrated? Am i wrong ? Do i need to install nvidia tools or other tools manually still? i got the same 4 error messages in both an empty project as well as a filled project.

CommandInvokationFailure: Gradle build failed.
C:\Program Files\Unity\Hub\Editor\2022.1.4f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath ā€œC:\Program Files\Unity\Hub\Editor\2022.1.4f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-6.1.1.jarā€ org.gradle.launcher.GradleMain ā€œ-Dorg.gradle.jvmargs=-Xmx4096mā€ ā€œassembleReleaseā€

stderr[

FAILURE: Build failed with an exception.

  • What went wrong:
    java.net.BindException: Address already in use: Cannot bind

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org
    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
    ]
    stdout[

]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <68ac4eda5e974ef0956de68d8cee468c>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <68ac4eda5e974ef0956de68d8cee468c>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <68ac4eda5e974ef0956de68d8cee468c>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action1[T] progress, System.String error) (at <68ac4eda5e974ef0956de68d8cee468c>:0) UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action1[T] progress) (at <68ac4eda5e974ef0956de68d8cee468c>:0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action`1[T] progress) (at <68ac4eda5e974ef0956de68d8cee468c>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <68ac4eda5e974ef0956de68d8cee468c>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <68ac4eda5e974ef0956de68d8cee468c>:0)
Rethrow as BuildFailedException: Exception of type ā€˜UnityEditor.Build.BuildFailedExceptionā€™ was thrown.
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <68ac4eda5e974ef0956de68d8cee468c>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <68ac4eda5e974ef0956de68d8cee468c>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, AndroidPlayerBuildProgram.Data.AndroidPlayerBuildProgramOutput buildProgramOutput) (at <68ac4eda5e974ef0956de68d8cee468c>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <68ac4eda5e974ef0956de68d8cee468c>: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 :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

i really dont want to reinstall everything to see if java is the issue. It also only happens on android builds, pc builds work fine. It happens in multiple unity versions. Anyone else having this problem?

2 Likes

Did you fix the error i canā€™t find a solution :confused:

there is a simple fix:
in my case the following works

use a higher API version and check if its working or notā€¦
means start with 5.0 lollipop as minimum Api for build.
if its not work then switch to 6.0 , and go furtherā€¦ the only solution works for me.

Iā€™m suffering from this, I had this problem when I went to compile for android, still without admob, this one I solved when I updated Unity to 2022.2.1f1.
so i had the same problem when i added admob ads and downloaded plugins from google, in this second case it was solved by deleting all files from /Assets/Plugins/Android folder
I just didnā€™t delete the GoogleMobileAds folder from there.
By doing this, the Google plugins were automatically downloaded and then it was possible to compile

Im using Unity 2022.1.16f1 and for building the apk, I had to go through a weird process as far as to say. In short we can say that ā€œwe change some settings > build > revert back settings > buildā€. Yea this seems weird but I have tried 4-5 times in a row.

The setting which is supposed to be altered is shown below

PROCESS:

  1. Try to build directly without changing any settings (if built successfully, ignore further steps)
  2. Tick mark ā€œCustom Main Gradle Templateā€
  3. Build the project
  4. It will give Gradle related some error.
  5. Uncheck ā€œCustom Main Gradle Templateā€ again.
  6. Finally build the project

After building the apk, Unity will redownload the android dependencies and when later you want to build the project again, you have to follow above steps again.

1 Like