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
  3. Dismiss Notice

Can't build apk, urgent help needed. [Solved]

Discussion in 'Android' started by betamech, Jun 27, 2014.

  1. betamech

    betamech

    Joined:
    Jun 27, 2014
    Posts:
    9
    I am new to Unity3D but took some tutorials for PC development and I tried to switch platform to Android to test if the app even opens on my Samsung Galaxy S4 but when I went to Build and Run Unity3D tells me that the device is not found (connected by USB, debugged) and when I try to Build only the following error occurs :

    Error building Player: Win32Exception: ApplicationName='C:/Users/betam_000/Desktop/adt-bundle-windows-x86_64-20140624/sdk\tools\zipalign.exe', CommandLine='4 "C:\Users\betam_000\Desktop\MakeAGame\Temp/StagingArea/Package_unaligned.apk" "C:\Users\betam_000\Desktop\MakeAGame\Temp/StagingArea/Package.apk"', CurrentDirectory='Temp/StagingArea'

    Hope to hear from anyone as soon as possible. Thanks in advance.
     
    hieudev and ozanyucel like this.
  2. hieudev

    hieudev

    Joined:
    Feb 16, 2014
    Posts:
    12
    i´m in the same problem. not solved. i think it would be something wrong with the sdk update. S***.


    edit:
    i just read something like to look for the zipaling.exe file and copy it into the sdk/tools folder. im,going to try it later.

    the link i´ve translated with google: http://unity3d.ru/distribution/viewtopic.php?f=5&p=176821

    edit2:
    FIXED aleluyah!!!!!
    here is the file, there one in each version folder, i used this one.
    C:\yourpath\adt-bundle-windows-x86-20131030\sdk\build-tools\20.0.0

    Copy it to C:\yourpath\sdk\tools\
     
    Last edited: Jun 27, 2014
  3. betamech

    betamech

    Joined:
    Jun 27, 2014
    Posts:
    9
    Thanks so much for the link but I don't understand the language. Can you please upload the file? Thanks once again for the help.

    Edit : Yeah, okay, I'm a little sleepy. Now I understand, let me try this!
    Second Edit : Finally, it works! Thanks so much for the help.
     
    Last edited: Jun 27, 2014
  4. lvictorino

    lvictorino

    Joined:
    Jul 9, 2012
    Posts:
    31
    It wasn't clear to me so :

    it's the zipalign.exe file from sdk\build-tools\{VERSION} directory that needs to be copied in sdk\tools directory.

    Thanks for the tip!
     
  5. maesty

    maesty

    Joined:
    Oct 5, 2012
    Posts:
    2
    I had to get the android sdk manager to download a new set of the build tools (20.0) as there wasn't a zipalign anywhere in the sdk folders, then moving as suggested worked fine.
     
    DionisioII and sampenguin like this.
  6. BuzzJive

    BuzzJive

    Joined:
    Mar 6, 2014
    Posts:
    75
    I just did a fresh install of 4.5.1 on a new computer and added the JDK and Android SDK. I needed to do this in order to get it to build an apk. Thanks guys!
     
  7. Chintao

    Chintao

    Joined:
    Jun 26, 2014
    Posts:
    54
    why don't i have the zipalign.exe in the build-tools/version? i searched with the search function, but i don't find it >.<

    edit: i just did a fresh download, now i have it =)
     
    Last edited: Jun 30, 2014
    faraz likes this.
  8. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Which version did you download? did you have to copy the zipalign.exe or it just worked?

    I think latest version of the Android SDK moved this tool to another folder (as stated above). I opened a bug about it.
     
    faraz likes this.
  9. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    faraz likes this.
  10. Demonith88

    Demonith88

    Joined:
    Jun 30, 2014
    Posts:
    217
    Also there is some of problems that there need to have a zipalign.exe from sdk\build-tools folder to past it in tools folder that helped for me
     
  11. vfxjex

    vfxjex

    Joined:
    Jun 3, 2013
    Posts:
    93
    yah I have this error too and i just downloaded the zipalign.exe in this site

    http://forum.xda-developers.com/showthread.php?t=1385846

    extract the file and copy the files inside Resources to
    C:\Development Tools\adt-bundle-windows-x86_64-20140624\sdk\tools
    or wherever you put yout adt-bundle
     
    sjamr likes this.
  12. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    This is a bug and it should be fixed in an upcoming Unity patch.
     
  13. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    vfxjex likes this.
  14. iarnazca

    iarnazca

    Joined:
    Jul 6, 2014
    Posts:
    3
    I have the newest version and needed to do this any ways.

    Thanks for the posts guys.
     
  15. Nub3h

    Nub3h

    Joined:
    Aug 23, 2012
    Posts:
    56
    mmm...I'm still getting the error with 4.5.2 and with the latest Android SDK:

    Error building Player: Win32Exception: ApplicationName='/Users/Robin/Development/AndroidSDK/sdk/tools/zipalign', CommandLine='4 "/Users/Robin/Desktop/MyGameAndroid/Temp/StagingArea/Package_unaligned.apk" "/Users/Robin/Desktop/MyGameAndroid/Temp/StagingArea/Package.apk"', CurrentDirectory='Temp/StagingArea'


    any idea? I'm using Mac.
     
  16. findujanvier

    findujanvier

    Joined:
    May 9, 2014
    Posts:
    15
    It happened because google had moved zipalign.exe from tools folder to build-tools folder. Just copy zipalign.exe to "tools" folder and everything should work!
     
  17. Nub3h

    Nub3h

    Joined:
    Aug 23, 2012
    Posts:
    56
    on Mac there's no zipalign.exe file. I updated Unity to 4.5.2 but I still had the problem afterwords. What I did then is to re-download Android SDK form the website and override the sdk folders, then it worked so the automatic update of Android was messing up something at least on Mac.
     
  18. sjamr

    sjamr

    Joined:
    May 13, 2014
    Posts:
    1
    Thank you very much, it worked.
     
    vfxjex likes this.
  19. BlackPanda

    BlackPanda

    Joined:
    Jan 24, 2014
    Posts:
    78
    Thanks so much..! :) Saved my day..
     
  20. ASSK

    ASSK

    Joined:
    Jul 18, 2014
    Posts:
    1
    You are my hero. I was one second away from bashing my laptop on the floor. After 3 days I finally found a answer. Thanks!
     
  21. Tekksin

    Tekksin

    Joined:
    Oct 20, 2013
    Posts:
    32
    This worked perfectly for me.
     
  22. eddie312

    eddie312

    Joined:
    Sep 13, 2012
    Posts:
    24
    i'm on mac and it did not fix the thing for me. (error after update of the android sdk with ast tool).
    to fix it in dowload new unity 4.5.2 and new android sdk of jully 2014
     
    faraz likes this.
  23. drussilla

    drussilla

    Joined:
    Mar 20, 2014
    Posts:
    9
    To fix this error:

    • Go to C:\Program Files (x86)\Android\android-sdk\build-tools\20.0.0 (you may have different version)
    • Copy zipalign.exe to C:\Program Files (x86)\Android\android-sdk\tools\ (or in your Android SDK path)
    source
     
    faraz likes this.
  24. davidsirmons

    davidsirmons

    Joined:
    Mar 16, 2014
    Posts:
    190
    version 20.0.0?!?
    Here's my structure:
    C:\development\adt-bundle-windows-x86-20140321\sdk\tools (zipalign.exe location)
    So, it's already there. Now what?...because I've searched here for:
    "align apk"
    "align android apk"
    "how to align an apk"
    and I keep getting the same links which bring me to this one thread.

    I'll go back and try to find whatever it is I've missed....
     
    faraz likes this.
  25. dylanfries

    dylanfries

    Joined:
    Jul 11, 2012
    Posts:
    16
    On Mac, its the same file it just doesn't have a .exe. Copy it from the build-tools folder to the tools folder and it should work
     
    faraz likes this.
  26. faraz

    faraz

    Joined:
    Aug 4, 2014
    Posts:
    46
    Thanks man it worked for me.

    it's the zipalign.exe file from sdk\build-tools\{VERSION} directory that needs to be copied in sdk\tools directory.
    source
     
    Last edited: Apr 1, 2015
    ibnesina likes this.
  27. UmbrAtroX

    UmbrAtroX

    Joined:
    Jul 25, 2012
    Posts:
    3
    Thanks, I didn't have zipaling. just have to download from sdk manager "Android SDK Build-tools" 20 and zipaling will be there, then copy it to sdk/tools. ;)
     
    faraz likes this.
  28. AiR19

    AiR19

    Joined:
    Sep 4, 2014
    Posts:
    1
    Thanks, I didn't have zipaling. just have to download from sdk manager "Android SDK Build-tools" 20 and zipaling will be there, then copy it to sdk/tools. ;)

    thanks guys !
     
    faraz likes this.
  29. sagits4

    sagits4

    Joined:
    Aug 15, 2014
    Posts:
    1
    This is not a unity bug. Android sdk has changed zipalign location from
    C:\YourPathToandroid-sdk\sdk\tools
    to
    C:\YourPathToandroid-sdk\build-tools\ someVersionYoudownload/zipalign

    The fastest way to get over it is to copy the zipalign from the new location to the old location.

    Another tip, unfortunally when updating your android sdk the new version deletes the zipalign and wont auto download it if you havent selected to download Android SDK Build Tools v 20 from Android SDK Manager.
     
  30. hfarazm

    hfarazm

    Joined:
    Nov 29, 2013
    Posts:
    3
    Simple Method:
    1.
    Goto directory where you installed android sdk version 20.0.0 :
    in my case I installed at : D:\Program Files (x86)\Android\android-sdk\build-tools\20.0.0
    2. Copy zipalign.exe
    3. Paste it in sdk folder which in my case is at: D:\Program Files (x86)\Android\android-sdk\tools
    4.
    Build & Run.
     
    faraz likes this.
  31. N2KMaster

    N2KMaster

    Joined:
    Jul 15, 2013
    Posts:
    64
    PERFECT! Worked like a dream now and this problem held up my game for 3 days. Thanks guys.
     
    faraz likes this.
  32. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Or just update to latest Unity - zipalign handling for newer SDK has been fixed in 4.5.1p4.
     
    liortal likes this.
  33. kujo

    kujo

    Joined:
    Aug 19, 2013
    Posts:
    106
    I've just installed Unity 4.5.5f1 on Mac and updated my packages on Android SDK Manager and I'm getting this problem. Has something changed again recently or have I missed something?
     
  34. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    kujo, can you please share your editor log? This should not really be a zipalign issue, probably another one.
     
  35. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Are you getting the exact same error (with zipalign.exe) ?
     
  36. kujo

    kujo

    Joined:
    Aug 19, 2013
    Posts:
    106
    @Yury Habets - I'm guessing its a zipalign issue because as soon as I move it back into tool, it works fine.

    I will post up my log later
     
  37. Keitaro3660

    Keitaro3660

    Joined:
    May 20, 2014
    Posts:
    86
    just update the android sdk and got this, lol
    luckily, everyone has solved this problem already XD
     
  38. morphusone

    morphusone

    Joined:
    Mar 12, 2014
    Posts:
    16
    This didn't work for me.

    I've narrowed the issue down to my last "handheldplaymovie" code but it keeps happening. Same build error every time.

    It started with the 4th movie file/code. So I re coded the movie put it in and it worked so I did the same for the next and it worked, third time no luck however. weird.....
     
  39. xc

    xc

    Joined:
    Nov 13, 2014
    Posts:
    3
    Ok, I've got the same problem. I worked on mac.
    Copy zipalign from build-tools folder to tools folder. This is work for me.
    upload_2015-3-28_11-40-55.png
     
  40. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Please don't copy the utilities from one folder to another.
    Update your SDK and Unity to latest versions. If you still have issues, report a bug, we will fix that.
     
  41. faraz

    faraz

    Joined:
    Aug 4, 2014
    Posts:
    46
    which SDK should we update?
     
  42. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    @faraz always use the latest stable one (not a preview), we are always checking it for compatibility and fixing if needed.
     
    ibnesina and faraz like this.
  43. Ayaan-Karmakar

    Ayaan-Karmakar

    Joined:
    Nov 28, 2015
    Posts:
    1
    Thanks a lot.. for this tip. It helps me and it works so far... my Unity 3d successfully created an (.apk) file. Now I can move on to the next stage...
    Great help..
     
  44. Dodia3D

    Dodia3D

    Joined:
    Jun 13, 2014
    Posts:
    1
    In my case it's problem due to environment variables were not set.So, In my windows pc I set PATH and CLASSPATH of java and then reboot the system and it's worked..:)
     
  45. ibnesina

    ibnesina

    Joined:
    Mar 15, 2014
    Posts:
    9
  46. DIP123

    DIP123

    Joined:
    Nov 6, 2017
    Posts:
    3
    This solve the problem
     

    Attached Files:

  47. rosdyantoherry

    rosdyantoherry

    Joined:
    Jul 13, 2019
    Posts:
    1
    I can't bulid a unity apk, please help me :

    UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
    at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0020e] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:181
    at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00065] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:88
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  48. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    The actual error is missing, you should have another error message in the console window.