Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Crash immediately upon trying to build to Android

Discussion in 'Android' started by jerotas, Mar 15, 2013.

  1. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Hi guys, earlier tonight I installed Unity 4.1 and I exported my game fine to Droid. Then a couple hours later, every time I try to export to Droid, Unity crashes immediately. I even tried rolling back to the same version of my game since it worked earlier tonight. No dice.

    Anyone else having the same problem?

    Oh, by the way, not sure if this is associated or not, but I'm using a test Android Pro license provided by UT and every time I go back to the Build Settings window, it has reverted back from Android to PC Standalone...I don't think that was happenning until tonight either.
     
    Last edited: Mar 15, 2013
  2. WarbladerToo

    WarbladerToo

    Joined:
    Nov 2, 2009
    Posts:
    96
    Sort of similar to what happen to me. I tried to export and build for iOS (iPad) and it crashed every time. I have removed 4.1 and is now back on 4.0.1. It could be some of the plugins that I used. (2dtoolkit, NGUI, UnitySerializer, EasySave)...
     
  3. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    Please file a bug report on this if you haven't already...
     
  4. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Yeah I did file a bug report.
     
  5. WarbladerToo

    WarbladerToo

    Joined:
    Nov 2, 2009
    Posts:
    96
    I found out why Unity 4.1 crashed when I tried to build for Android or iOS. The project folder name contained spaces and that seem to be the problem. Renamed folders and it build the iOS version OK. Not tested on the android version.
     
  6. WarbladerToo

    WarbladerToo

    Joined:
    Nov 2, 2009
    Posts:
    96
    Well so much for that fix. Its now back to crashing like crazy again. Switching platform is now impossible. Just crashing and I have no idea how to get back from the selected iOS platform to the Mac/PC one. This is very nice from a "professional" tool....
     
  7. Marasto

    Marasto

    Joined:
    Feb 4, 2013
    Posts:
    3
    Same problem too...
     
  8. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    334
    yep, just started getting this once we upgraded to 4.1. We also have filed a report.
     
  9. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Awesomely, the bug fix for our game crashing on Android is only included in this 4.1 fix, in which I can't even export any longer. Which is even worse :(
     
  10. DavidBFox

    DavidBFox

    Joined:
    Aug 7, 2012
    Posts:
    6
    Happening to me too. I just updated to 4.1 today... I'm assuming that's what caused the problem. I ended up downgrading back to 4.01 and can build in iOS again. My Mac and Windows builds were fine in 4.1, though. I also updated my OS X to 10.8.3 today so that's another variable.

    WarbladerToo - I can switch back to Mac or PC by selecting Build Settings from the File menu (Shift-Command-B).
     
  11. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    334
    After another attempt to upgrade to fix the crash bug and upgrading from 4.1.0 and then to 4.1.2, cleaning the entire project by exporting all scenes and dependencies to a new package and creating a new project, sending Unity a copy of the project which they found no issues, we gave up and reverted back to Unity 4.0.

    Now we can build our Android release again using Unity 4.0. This experience has left me with little faith in Unity's Q+A, I will certainly not be changing my build version again during production.
     
  12. Time-Jockey

    Time-Jockey

    Joined:
    Oct 11, 2012
    Posts:
    14
    Having a quick digging around in the logs, it looks like [ExecuteInEditMode] was causing the problem. Just commented them all out and now I can switch to Android just dandy.

    This was the log entry that gave it away:

    I commented them all out, switched platform, then put them back in and things seem to be running fine.
     
  13. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    Can someone please drop a case number in this thread? I'm guessing there is already a bunch of people looking into this, but I want to make sure that is the case.
     
  14. samuelmorais

    samuelmorais

    Joined:
    Aug 3, 2012
    Posts:
    62
    @TimeJockey, I did what you suggest (commented all occurrences of "[ExecuteInEditMode]"), but it didn't work for me. Unity Editor crashes every time I try to switch platform to Android. I have tried version 4.1.0 and 4.1.2.
    This problems occurs only in one project. The other ones are switching between platforms without problem.
     
  15. samuelmorais

    samuelmorais

    Joined:
    Aug 3, 2012
    Posts:
    62
    Ok, just because I have commented, I could find a solution (at least in my case).
    The trick is to uncheck all the scenes in Build Settings and, after that, click on "Switch Platform" to Android.
     
  16. sharkyx

    sharkyx

    Joined:
    Mar 20, 2013
    Posts:
    8
    That helped me. I used Replace in Files in Monodevelop and replaced all [ExecuteInEditMode] with //[ExecuteInEditMode], saved all files, switched the platform and did the replacement in reverse.
     
  17. bravery

    bravery

    Joined:
    Mar 26, 2009
    Posts:
    270
    Hi Guys,

    Anyone found any solution for this one? I'm facing the same problem.

    Please advise.
     
  18. theHost

    theHost

    Joined:
    Nov 30, 2009
    Posts:
    37
    This trick got me to switch platform from PC to Android without crashing. Thank you.
     
  19. captain_geek

    captain_geek

    Joined:
    Apr 1, 2013
    Posts:
    1
    Thanks for all the help in this thread ... I am now happily building for iOS

    I am running 4.1.2 and had not built my project before for iOS but had the same problem where it was immediately crashing when I hit the "Build" button.

    The fix for my project was commenting out the "[ExecuteInEditMode]" statements in all the scripts. This seemed to be most prevalent in NGUI and the Standard Assets/Image Effects (Pro Only)

    [UPDATE]

    The author of NGUI told me that he encountered the same problem, his workaround was to start a "New Scene" before building for iOS ... reverted my script edits and tried the same thing, no crash occurred ... happy build!
     
    Last edited: Apr 17, 2013
  20. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Be careful doing that. Commenting out ExecuteInEditMode will break NGUI's functionality in the editor.

    Work-around that works for me is starting a new scene prior to switching build targets and/or building.

    P.S. If there is a case number on this, let me know what it is please.
     
  21. joelmgallant

    joelmgallant

    Joined:
    Mar 9, 2009
    Posts:
    113
    Confirmed over here that switching platforms in a new empty scene works - thanks ArenMook! :eek:
     
  22. gekidoslair

    gekidoslair

    Joined:
    Sep 7, 2012
    Posts:
    128
    having same problem here, nothing worked, but doing the switch platforms with an empty scene worked for me as well (weh). Thanx ArenMook!
     
  23. Ches81

    Ches81

    Joined:
    Nov 27, 2012
    Posts:
    7
    same here
     
  24. Alesk

    Alesk

    Joined:
    Jul 15, 2010
    Posts:
    340
    Hi,

    Unity 5.0.2f1, same crash problem during build if I keep [ExecuteInEditMode] in one of my scripts.
    Building from an empty scene and/or switching platforms doesn't help at all :(

    Any other idea ?

    [EDIT] : I've found a solution. I had some code in the Awake() method, I moved it in Start() since it wasn't a big deal in my case, and now it's compiling
     
    Last edited: Jun 6, 2015