Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Build Error - Error building Player: 2 errors

Discussion in 'Editor & General Support' started by Deleted User, Aug 30, 2017.

  1. Deleted User

    Deleted User

    Guest



    I keep getting this error when trying to build and run to my Android device for testing. I've searched heavily on this error for a whole week and most of the solutions were to get rid of scripts that were using "using UnityEditor", but I don't have any scripts that use UnityEditor. The only scripts that use UnityEditor are the GooglePlayServicesPlugin scripts.

    I don't really know how to debug it too since it doesn't highlight the files when I click on the error. I really need help on this because it's been holding me back for one whole week.

    Section of log where the error appears and build gets canceled:
    Code (CSharp):
    1. DisplayProgressNotification: Build Failed
    2. Error building Player: 2 errors
    3. (Filename:  Line: -1)
    4.  
    5. Refresh: detecting if any assets need to be imported or removed ... Refresh: elapses 0.011370 seconds (Nothing changed)
    6. Unloading 54 Unused Serialized files (Serialized files now loaded: 0)
    7. System memory in use before: 74.0 MB.
    8. System memory in use after: 74.2 MB.
    9.  
    10. Unloading 49 unused Assets to reduce memory usage. Loaded Objects now: 3363.
    11. Total: 10.974792 ms (FindLiveObjects: 0.299456 ms CreateObjectMapping: 0.052543 ms MarkObjects: 10.576966 ms  DeleteObjects: 0.044641 ms)
    12.  
    13.     Ignoring 'Assets/Plugins/UnityPurchasing/Bin/Apple/live/Apple.dll' because we're compiling for Editor:Editor
    14.    Ignoring 'Assets/Plugins/UnityPurchasing/Bin/Editor.dll' because we're compiling for Editor:Editor
    15.     Ignoring 'Assets/Plugins/UnityPurchasing/Bin/Facebook/live/FacebookStore.dll' because we're compiling for Editor:Editor
    16.    Ignoring 'Assets/Plugins/UnityPurchasing/Bin/Security/Security.dll' because we're compiling for Editor:Editor
    17.     Ignoring 'Assets/Plugins/UnityPurchasing/Bin/Tizen/live/Tizen.dll' because we're compiling for Editor:Editor
    18.    Ignoring 'C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/Standalone/UnityEngine.UI.dll' because we're compiling for Editor:Editor
    19.     Ignoring 'C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/Networking/Standalone/UnityEngine.Networking.dll' because we're compiling for Editor:Editor
    20.    Ignoring 'C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/UnityHoloLens/Runtime/UnityEngine.HoloLens.dll' because we're compiling for Editor:Editor
    21.     Ignoring 'C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/UnityVR/Runtime/UnityEngine.VR.dll' because we're compiling for Editor:Editor
    22.    Ignoring 'Library/FacebookSDK/Facebook.Unity.Arcade.dll' because we're compiling for Editor:Editor
    23.     Ignoring 'Library/FacebookSDK/Facebook.Unity.dll' because we're compiling for Editor:Editor
    24.    Ignoring 'Library/FacebookSDK/FacebookNamedPipeClient.dll' because we're compiling for Editor:Editor
    25.     Ignoring 'Assets/Plugins/UnityPurchasing/Bin/Apple/live/Apple.dll' because we're compiling for Editor:Editor
    26.    Ignoring 'Assets/Plugins/UnityPurchasing/Bin/Editor.dll' because we're compiling for Editor:Editor
    27.     Ignoring 'Assets/Plugins/UnityPurchasing/Bin/Facebook/live/FacebookStore.dll' because we're compiling for Editor:Editor
    28.    Ignoring 'Assets/Plugins/UnityPurchasing/Bin/Security/Security.dll' because we're compiling for Editor:Editor
    29.     Ignoring 'Assets/Plugins/UnityPurchasing/Bin/Tizen/live/Tizen.dll' because we're compiling for Editor:Editor
    30.    Ignoring 'C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/Standalone/UnityEngine.UI.dll' because we're compiling for Editor:Editor
    31.     Ignoring 'C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/Networking/Standalone/UnityEngine.Networking.dll' because we're compiling for Editor:Editor
    32.    Ignoring 'C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/UnityHoloLens/Runtime/UnityEngine.HoloLens.dll' because we're compiling for Editor:Editor
    33.     Ignoring 'C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/UnityVR/Runtime/UnityEngine.VR.dll' because we're compiling for Editor:Editor
    34.    Ignoring 'Library/FacebookSDK/Facebook.Unity.Arcade.dll' because we're compiling for Editor:Editor
    35.     Ignoring 'Library/FacebookSDK/Facebook.Unity.dll' because we're compiling for Editor:Editor
    36.    Ignoring 'Library/FacebookSDK/FacebookNamedPipeClient.dll' because we're compiling for Editor:Editor
    37. - starting compile Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll, for buildtarget 13
    38.  
    39. *** Cancelled 'Build.Player.AndroidPlayer' in 23 seconds (22818 ms)
     
    Last edited by a moderator: Aug 30, 2017
  2. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    It should be highlighting which scripts are using UnityEditor once the build fails, you can also try building for Windows and Mac to see if it spits out the errors properly there. I don't see why it would make a difference but worth a try.

    Anyway as for your problem, do a text search for your entire project and look for "uding UnityEditor". If its in Any scripts that are not in an 'Editor' folder then that script will fail to compile. If you need to keep that code in there then you can wrap it in:

    #if(UNITY_EDITOR)
    using UnityEditor;
    #endif

    But you also need to apply that to anywhere that needed that reference, such as EditorGUILayout.Floatfield etc.
     
  3. Deleted User

    Deleted User

    Guest

    I searched the whole project, and the only scripts that are using UnityEditor are the Google Play Services Scripts and UnityIAPPurchasing scripts; those scripts are in their respective Editor folders too. This really sucks.

    I updated my post with the section of the log where the error occurs.
     
    Last edited by a moderator: Aug 30, 2017
  4. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    705
    Afraid to say best thing to do now is to start removing those scripts and seeing if you can pinpoint where the problem is
     
  5. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,635
    Did you ever fix this? I am having the same problem, the log doesnt even tell you what the errors are or, where they are, I have been trying to fix things that get mentioned but the error number never goes down. How the hell do you work out whats causing it not to build??
     
  6. Deleted User

    Deleted User

    Guest

    I actually did fix this problem, but I don't actually remember what I did. All I remember was that it was a frustrating to get it working again.

    I think the first thing I tried was reverting back to an older, stable version of Unity. Then I think that didn't work for me, so I removed all my plugins and reimported them. Not entirely sure if that's what I did to make it solve my problem, but I don't have that problem anymore.

    Also, make sure you back up before you try anything that I just mentioned.
     
  7. kk99

    kk99

    Joined:
    Nov 5, 2013
    Posts:
    81
    Wanna share my solution, too.

    After upgrading from 5.5 to 5.6.5f1 I SIMPLE WAS NOT ABLE TO BUILD MY PROJECT FOR ANDROID ANYMORE. I received the exact same error only difference was a higher Number lol 10 Build Errors with No Details.

    With total 20+ scenes it took me forever to narrow down the issue.

    The problem was texture compressions for terrains textures and a few sprites.
    It drove me literally nuts. Apparently Unity 5.6.x does not support ECB4, DXT1 and 16 bit for Android anymore and maybe a bunch others too.

    I guess for the future the most save way to compress stuff is doing it by yourself without using Unity built in compression
     
    Last edited: Jan 27, 2018
  8. Angelica_ortiz

    Angelica_ortiz

    Joined:
    Jul 1, 2017
    Posts:
    1
    For me, the problem was resolved when I switched the platform in build settings to something else (like PC) and then switched it back to iOS like I wanted. I think it was missing some assembling libraries. Hope this helps someone!
     
    RavoGames, radiantboy and Benfont like this.
  9. AlharbiSunds

    AlharbiSunds

    Joined:
    Jul 17, 2018
    Posts:
    5
    I know this old thread, but I faced this problem today when I tried to compile the server build.
    The problem was because I leave the USB-C connected to my phone. when I unplugged it, the compilation is successfully completed.
     
    radiantboy likes this.
  10. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,635
    theres another good thread about this. Basically it usually boils down to something being included from unityEditor, make sure all of them lines are surrounded by #if UNITY_EDITOR using UnityEditor; etc
     
  11. Nick_Wildy

    Nick_Wildy

    Joined:
    Nov 6, 2022
    Posts:
    1
    well i just tried looking for any files that had "Using UnityEditor" and just deleted it. It was a very simple fix