Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

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

Discussion in 'VR' started by aCake0202, May 20, 2021.

  1. aCake0202

    aCake0202

    Joined:
    Mar 11, 2021
    Posts:
    25
    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&)
     
  2. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
    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?
     
  3. aCake0202

    aCake0202

    Joined:
    Mar 11, 2021
    Posts:
    25
    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
     
    Last edited: May 20, 2021
  4. ForceVFX

    ForceVFX

    Joined:
    Jan 21, 2011
    Posts:
    597
  5. aCake0202

    aCake0202

    Joined:
    Mar 11, 2021
    Posts:
    25
  6. str3lok

    str3lok

    Joined:
    May 27, 2012
    Posts:
    24
    Open the project. Start the project build. After the error appears, take the editor log file (https://docs.unity3d.com/Manual/LogFiles.html) 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.
     
  7. luka7murra

    luka7murra

    Joined:
    Sep 11, 2022
    Posts:
    1
    I had same issue, but if I use just "Build" (not "Build And Run") the .exe is created and works fine
     
  8. blackrobot_games

    blackrobot_games

    Joined:
    Jun 24, 2021
    Posts:
    7
    Exactly the same for us (the only difference is that we are building for mobile not for desktop)
     
  9. ash_at_unity3d

    ash_at_unity3d

    Unity Technologies

    Joined:
    Jan 9, 2020
    Posts:
    41
    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.
     
  10. kristof2000

    kristof2000

    Joined:
    Oct 15, 2016
    Posts:
    25
    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.Action`1[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.Action`1[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 <ee6fd03ff96245f993c3cba83ed9657b>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)
     
  11. kristof2000

    kristof2000

    Joined:
    Oct 15, 2016
    Posts:
    25
    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?
     
    Ar1zen likes this.
  12. ReinaJaafar

    ReinaJaafar

    Joined:
    Oct 5, 2022
    Posts:
    1
    Did you fix the error i can't find a solution :/
     
  13. aftab47

    aftab47

    Joined:
    Nov 12, 2022
    Posts:
    1
    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.
     
  14. macaconinja

    macaconinja

    Joined:
    Dec 12, 2022
    Posts:
    1
    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
     
  15. YashKeni

    YashKeni

    Joined:
    Jul 14, 2021
    Posts:
    1
    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.
     

    Attached Files: