Search Unity

Bug Newest 2022 editor versions have consistently failed to overwrite previous builds

Discussion in 'Editor & General Support' started by KingKRoecks, Mar 19, 2023.

  1. KingKRoecks

    KingKRoecks

    Joined:
    Jul 28, 2013
    Posts:
    155
    When you Build & Run, the expectation has always been that the previous build is overwritten.
    With whatever has changed, the process waits until the VERY END of the build to tell you that it couldn't overwrite the previous

    UnityException: Error
    The destination path 'G:/GameProjects/<Game>/Build/android.apk' collides with existing file. Please delete 'G:/GameProjects/<Game>/Build/android.apk' before retrying the operation.
    UnityEditor.EditorApplication:Internal_CallGlobalEventHandler()

    Additionally, if you Build & Run as opposed to a Build, Unity will create a folder named "build.apk" rather than building it into the file.

    These issues are very frustrating. Please fix them.
     
    ROBYER1, euden_one, sandstedt and 7 others like this.
  2. KingKRoecks

    KingKRoecks

    Joined:
    Jul 28, 2013
    Posts:
    155
  3. AlexBourgeois

    AlexBourgeois

    Joined:
    Oct 30, 2017
    Posts:
    9
    Hi, same problem for me with Unity 2021.3.21f1
     
    torsknod likes this.
  4. AllanRW

    AllanRW

    Joined:
    Nov 6, 2014
    Posts:
    37
    Same here, very annoying bug, I usually hit CMD-B and leave but now the build fails showing that the apk already exists.

    Unity 2021.3.21f1
     
  5. svenneve

    svenneve

    Joined:
    May 14, 2013
    Posts:
    80
    Same for 2021.3.20f1
     
    torsknod likes this.
  6. Davidnovarro

    Davidnovarro

    Joined:
    Oct 6, 2015
    Posts:
    22
    Same here, it does not check in the beginning, every time you have to wait for the build to complete and then it fails, because the previous APK file was not removed, really annoying...
     
    Last edited: Mar 27, 2023
  7. Idual

    Idual

    Joined:
    Mar 11, 2015
    Posts:
    14
    Same 2021.3.21f1
     
    torsknod likes this.
  8. RSH1

    RSH1

    Joined:
    Jul 9, 2012
    Posts:
    256
    Same problem with 2021.3.21f1. Sometimes after deleting Unity creates the .apk or .aab as a directory, also.
     
    torsknod likes this.
  9. RSH1

    RSH1

    Joined:
    Jul 9, 2012
    Posts:
    256
    Building as .aab in 2021.3.22f1 straight away creates a directory, which of course won't deploy to an Android device.

    upload_2023-3-31_14-55-8.png

    HOW is this issue in SEVERAL "long term support" releases?
     
    torsknod likes this.
  10. mafiasniper

    mafiasniper

    Joined:
    Jul 29, 2020
    Posts:
    3
    Same issue here with Unity 2021.3.20f1
     
  11. Westbang

    Westbang

    Joined:
    May 25, 2020
    Posts:
    4
    Same issue here with Unity 2023.2.0a7 newest Unity Editor today under Win 11

    I solve the Problem by:

    1. First delete all files from your APK export directory. (The Export directory must be empty)

    2. Don't use from the Main Menu File->Build And Run !!!

    3. Use: File->Build Settings...

    4. In the Build Settings Dialogue bottom right klick "Build And Run"

    5. An Open Select Dialogue appears

    6. This dialogue shows the file name with its extension
    e.g. in my case "TerraCombat2023.aab" or "TerraCombat2023.apk"

    7. Important: Delete the extension .apk or .aab from the file name -> "TerraCombat2023"
    (export name without extension)

    8. Then click the save Button (The Export directory must be empty!)

    Regards Tom

    Unity Error-3.jpg
     
    Last edited: Apr 1, 2023
    DhiaSendi and aliaksei_immersive like this.
  12. jimblackler0

    jimblackler0

    Joined:
    Jul 3, 2018
    Posts:
    4
    Same on 2023.1.0b9. Big time sink.
     
  13. xasmundx

    xasmundx

    Joined:
    Jan 28, 2015
    Posts:
    1
    Same.
    2020.3.46f1
    2021.3.20f1
     
  14. AlexisDelforges

    AlexisDelforges

    Joined:
    Nov 30, 2021
    Posts:
    22
    Same 2021.3.21f1.
    Very annoying by the way.
     
  15. BenKnightBOX

    BenKnightBOX

    Joined:
    May 23, 2020
    Posts:
    2
    Add me to the list of frustrated. Also the Apr. 1st post suggestion does not work for me on my Mac. Not sure if the OS matters in this case.
     
  16. AllanRW

    AllanRW

    Joined:
    Nov 6, 2014
    Posts:
    37
    Reply from Unity QA Team:

    "Hi, Thanks for getting in touch, we actually know about this issue and it will be addressed shortly. Currently I have no information to share with you about this issue, however. Please reach out to me if I can answer any questions or be of further help. Thanks, Rytis Customer QA Team"
     
    torsknod, GGoldstein and LeekAndRibs like this.
  17. milox777

    milox777

    Joined:
    Sep 23, 2012
    Posts:
    195
    Suddenly appeared on 2020.3.47f. A bit annoying to have to delete the apk every time, when you do test builds often.
     
  18. StoneOakvalley

    StoneOakvalley

    Joined:
    Jan 11, 2021
    Posts:
    5
    Didn't have this issue with 2021.3.22f1, but after clean install with 2021.3.23f1 it happened here too. First time it builds. APK and deploys to Quest 2. Second time around, long wait until it says I have to delete previous samename .apk, so I delete that, trying to rebuild it now creates a directory named the same with .apk and puts all files in there, takes forever and breaks everything. I never had any issues with rebuilds over the previous samename.apk. Trying a Clean Build, but I also see Unity folks are aware of the issue. Hope they can figure out of it soon, its quite annoying.
     
  19. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    518
    Same on 2021.3.23, everythign was ok on 2021.3.20
     
  20. AllanRW

    AllanRW

    Joined:
    Nov 6, 2014
    Posts:
    37
    everyone here should send a bug report to this issue, seems like the team is not giving atention to this annoying bug.
     
  21. kcastagnini

    kcastagnini

    Joined:
    Dec 14, 2019
    Posts:
    61
    Same issue with Unity 2021.3.23f1
     
  22. designico

    designico

    Joined:
    Apr 2, 2013
    Posts:
    13
    Same here! Eats quite much time.
     
  23. ArthurZBaney

    ArthurZBaney

    Joined:
    Sep 22, 2017
    Posts:
    1
    Same issue, Unity 2021.3.23f1.
    Just wasted like 5 minutes waiting for my project to build and then at the last minute the build fails and shows me this error. Very frustrating.
     
  24. schouffy

    schouffy

    Joined:
    Mar 8, 2015
    Posts:
    10
    So much time wasted... Please rollback this to the way it was for years, which was to just overwrite...
    If not for us do it for the planet, think of all the power consumption just to show an error message :p
     
    Last edited: May 10, 2023
  25. schouffy

    schouffy

    Joined:
    Mar 8, 2015
    Posts:
    10
    That is fixed in 2021.3.25 and I can confirm it works again. Thanks!
     
    DhiaSendi, AllanRW and BenKnightBOX like this.
  26. AllanRW

    AllanRW

    Joined:
    Nov 6, 2014
    Posts:
    37
    Finally!

    • Build Pipeline: Fixed android build failure issue where were are getting an error message ' build destination path collides with an existing path' when triggered using Ctrl+B (Windows) or Cmd+B (macOS) keyboard shortcut. (UUM-30911)
     
    DhiaSendi likes this.
  27. cmdexecutor

    cmdexecutor

    Joined:
    Sep 30, 2014
    Posts:
    21
    Was that really fixed? Today we hit this on 2022.3.0

    PS happens when clicked "patch and run"
    Code (CSharp):
    1. UnityException: Error
    2. The destination path 'D:/PROJECTS/unity-mobile-client' collides with existing folder. Please delete 'D:/PROJECTS/unity-mobile-client' before retrying the operation.
    3. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    4.  
     
    HonG4444 likes this.
  28. petersvp

    petersvp

    Joined:
    Dec 20, 2013
    Posts:
    63
    Annoying, but since I'm using BuildPipeline.BuildPlayer i just added code to go and EMPTY the target folder :)
     
  29. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    This is doing my head in with android .apk builds where the editor used to always overwrite the last apk, happening with Unity 2020.3.46f1
     
  30. siempus

    siempus

    Joined:
    Nov 29, 2017
    Posts:
    12
    this issue isn't necessarily a bug though. the problem is that unity informing us about the project folder conflict, which is not correct. the correct one is "build/output" folder or file conflict. this confuse me every time it happened. yes, this happen to me a few times, and i have to google the issue every time cause i keep forgetting about this.
     
  31. RSH1

    RSH1

    Joined:
    Jul 9, 2012
    Posts:
    256
    It's most definitely a bug as it didn't used to happen. Has this been fixed in any subsequent release yet?
     
  32. socialtrens

    socialtrens

    Joined:
    Oct 23, 2017
    Posts:
    65
    Guest what? This bug still exists in 2022.3.7f1 (the latest version of LTS as I writing this comment).
     
    levoxtrip likes this.
  33. athacus

    athacus

    Joined:
    Apr 11, 2022
    Posts:
    2
    This bug still exists in 2023.1.11f1, encountered it today.
     
  34. Khaeops

    Khaeops

    Joined:
    Dec 28, 2014
    Posts:
    31
    Got this error today on 2022.3.2f1, tells me to delete my project folder.
     
  35. GravByte

    GravByte

    Joined:
    Mar 1, 2018
    Posts:
    4
    Adding to this with 2022.3.9f1.
    Although it only started happening once I added a keystore, but it occurs regardless if I add in my key passwords or use a debug key.

    The error message says to delete the actual project directory for some reason. And it occurs when trying to patch to my phone and not even making a build file on the pc directory.

    Luckily I seem to have found a workaround by using a third party tool called MultiTarget Build.
    After using that, while I was testing, it seems the normal build process is working normal again. weird.
     
  36. In2Play

    In2Play

    Joined:
    Apr 25, 2016
    Posts:
    66
    I'm using 2021.3.24f1 and I'm getting that bug. Has this been fixed in late versions?
     
  37. trinit

    trinit

    Joined:
    Sep 18, 2017
    Posts:
    2


    1. Create ‘Editor’ folder in Assets.
    2. Create new script inside and name it ‘Build255.cs’.
    3. Open script then add this code in.

    using UnityEditor;
    using UnityEngine;
    using UnityEditor.Build.Reporting;
    using System.IO;

    public class Build255 : MonoBehaviour
    {
    [MenuItem("Build/Build Hafez255.ir %b")]
    public static void MyBuild()
    {
    BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();
    //** Custom Open Window Panel to Get locationPath and productName
    //BuildPlayerWindow.DefaultBuildMethods.GetBuildPlayerOptions(buildPlayerOptions);

    string path = Path.Join(buildPlayerOptions.locationPathName, Application.productName);
    if (File.Exists(path + "_BurstDebugInformation_DoNotShip"))
    File.Delete(path + "_BurstDebugInformation_DoNotShip");
    if (File.Exists(path+".apk"))
    File.Delete(path+".apk");

    buildPlayerOptions.locationPathName = path+".apk";
    //** Custom BuildTarget (Android, ios, Windows, Linux ,... )
    buildPlayerOptions.target = BuildTarget.Android;
    buildPlayerOptions.options = BuildOptions.None;
    buildPlayerOptions.options = BuildOptions.AutoRunPlayer;
    BuildReport report = BuildPipeline.BuildPlayer(buildPlayerOptions);
    BuildSummary summary = report.summary;

    if (summary.result == BuildResult.Succeeded)
    Debug.Log("Build succeeded: " + summary.totalSize + " bytes");

    if (summary.result == BuildResult.Failed)
    Debug.Log("Build failed");
    }
    }
     
  38. trinit

    trinit

    Joined:
    Sep 18, 2017
    Posts:
    2
    1. Create ‘Editor’ folder in Assets.
    2. Create new script inside and name it ‘Build255.cs’.
    3. Open script then add this code in.

    using UnityEditor;
    using UnityEngine;
    using UnityEditor.Build.Reporting;
    using System.IO;

    public class Build255 : MonoBehaviour
    {
    [MenuItem("Build/Build Hafez255.ir %b")]
    public static void MyBuild()
    {
    BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();
    //** Custom Open Window Panel to Get locationPath and productName
    //BuildPlayerWindow.DefaultBuildMethods.GetBuildPlayerOptions(buildPlayerOptions);

    string path = Path.Join(buildPlayerOptions.locationPathName, Application.productName);
    if (File.Exists(path + "_BurstDebugInformation_DoNotShip"))
    File.Delete(path + "_BurstDebugInformation_DoNotShip");
    if (File.Exists(path+".apk"))
    File.Delete(path+".apk");

    buildPlayerOptions.locationPathName = path+".apk";
    //** Custom BuildTarget (Android, ios, Windows, Linux ,... )
    buildPlayerOptions.target = BuildTarget.Android;
    buildPlayerOptions.options = BuildOptions.None;
    buildPlayerOptions.options = BuildOptions.AutoRunPlayer;
    BuildReport report = BuildPipeline.BuildPlayer(buildPlayerOptions);
    BuildSummary summary = report.summary;

    if (summary.result == BuildResult.Succeeded)
    Debug.Log("Build succeeded: " + summary.totalSize + " bytes");

    if (summary.result == BuildResult.Failed)
    Debug.Log("Build failed");
    }
    }