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.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Bug Can't build for Android

Discussion in 'Android' started by iMobCoding, Jul 8, 2022.

  1. iMobCoding

    iMobCoding

    Joined:
    Feb 13, 2017
    Posts:
    154
    Latest Hub 3.2.0 in combination with Unity 2021.3.6 can't build for Android because there is a missing Tools folder inside Editor\Data\PlaybackEngines\AndroidPlayer\ so Unity can't find gradle.

    That folder is simply not created during the installation.
    The workaround is to copy the whole Tools folder from the previous Unity version or if you don't have the previous version then do what @Zeeppo-Games says in the post below.
     
    Last edited: Jul 10, 2022
    kshitijv, alliexpdx, Erothez and 26 others like this.
  2. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,736
    It didn't get download even if you select Android module while installing form hub?
     
  3. iMobCoding

    iMobCoding

    Joined:
    Feb 13, 2017
    Posts:
    154
    Installed all Android modules like always...
     
  4. Zeeppo-Games

    Zeeppo-Games

    Joined:
    May 13, 2015
    Posts:
    62
    I had the same issue, looks like the gradle folder has changed from AndroidPlayer\SDK\Tools to AndroidPlayer\SDK\cmdline-tools but the path still the old one inside Unity preferences.
     
  5. Zeeppo-Games

    Zeeppo-Games

    Joined:
    May 13, 2015
    Posts:
    62
    Right, this is it. I was able to build it. Copy all folders and files inside cmdline-tools, create a new folder called Tools inside AndroidPlayer folder and paste there.

    Unity guys, you've forgotten to change the paths in AndroidBuildPostProcessor!!!!


    Edit: or maybe this is something related to Android SDK 33, the one I'm using to build this version of the game.
     
    Last edited: Jul 8, 2022
  6. krzychuwr1_unity

    krzychuwr1_unity

    Joined:
    Jul 28, 2019
    Posts:
    3
    Having the same issue, rolling back to Unity 2021.3.5 for now
     
  7. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,736
    I can confirm the paths are wrong in 2021.3.6 and not specific to Android sdk version. Wondering how it even passed QA :eek:
     
  8. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    9,994
    I guess making an empty project and building for android is not one of the tests they do before they release their latest LTS to the world.

    Unity is a dumpster fire.
     
    Last edited: Jul 9, 2022
  9. OscarLeif

    OscarLeif

    Joined:
    Jul 17, 2016
    Posts:
    66
    Yep there's a bug there.
    You have to manually use the Fix that ZeppoGames says.
     
  10. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    925
    Yep broken.
    Missing dependencies.

     
  11. heiwa-games

    heiwa-games

    Joined:
    Apr 8, 2018
    Posts:
    7
    Hi all,

    I had the same issue iMobCoding reported at the beginning of the thread and following his workaround helped me in "unlocking" the next problem. I could solve this by following Zeeppo-Games's hint.

    So both helped me a lot, thanks to both of you!

    Regarding the QA of Unity. That seems really sloppy to me... .
     
  12. benjaminnkem

    benjaminnkem

    Joined:
    Mar 25, 2022
    Posts:
    1
    It worked for me.. Thanks @Zeepoo-Games
     
  13. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    485
    @Tomas1856 Could you please take a look at this bug? When will the fixed version be available?
     
    Last edited: Jul 11, 2022
  14. Arda_FitXR

    Arda_FitXR

    Joined:
    Apr 28, 2022
    Posts:
    1
    Thank you for the solution. More thanks Unity QA team. Use LTS version they said...
     

    Attached Files:

    ito123456789 likes this.
  15. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    3,477
    Is there already a bug report filed?
     
  16. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    9,994
    Probably not, bug reports are a waste of time IMO.
     
  17. Alex27

    Alex27

    Joined:
    Jul 8, 2022
    Posts:
    1
    thank you,
    copied from Windows 10 (2021.3.5f) to Mac for M1 version (2021.3.6), worked too
     
  18. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    3,477
    They fixed multiple of my issues actually, so I don't quite agree there
     
    matheus_inmotionvr likes this.
  19. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    9,994
    On average, it’s less effort to work around the issues than to get Unity to fix them in a timeframe that matters.
     
  20. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    3,477
    Many studios work on a project for months-years, so it depends on your project. And doing something for your future projects or future developers can be nice for 5 minutes of work
     
  21. Matheuz

    Matheuz

    Joined:
    Aug 27, 2014
    Posts:
    17
    Bug reported, case IN-9977. I will update this post whenever I get any news about it.
     
  22. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    9,994
    Many bugs take months / years to be fixed, and most people should have found workarounds before that.
     
  23. unity_2jxHNVY36zr2mg

    unity_2jxHNVY36zr2mg

    Joined:
    Jan 17, 2020
    Posts:
    86
    Dear Unity team please test you product before release
     
  24. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    9,994
    Why? When they have an army of users to test and bug report for them?
     
  25. SHalperin

    SHalperin

    Joined:
    Jul 13, 2013
    Posts:
    12
    Having the same problem.
     
  26. Oscar-Tsang

    Oscar-Tsang

    Joined:
    Nov 7, 2012
    Posts:
    78
    on Mac, when copy 2021.3.5f1 Tools

    Win32Exception: Native error= Access denied
     
  27. epochplus5

    epochplus5

    Joined:
    Apr 19, 2020
    Posts:
    677
    Worked thanks guys!!! copied the 2.5 folder from cmd-tools into a Tools folder i created in the Android Player folder, it didnt work, then i copied everything out of 2.5 folder into the Tools folder....building again! Thanks again!!!
     
    TerraUnity likes this.
  28. tyebeach_unity

    tyebeach_unity

    Joined:
    May 9, 2020
    Posts:
    7
    I can't find the AndroidPlayer\SDK\cmdline-tools where is it located?
     
  29. tyebeach_unity

    tyebeach_unity

    Joined:
    May 9, 2020
    Posts:
    7
    Found it nevermind
     
  30. panzmicier

    panzmicier

    Joined:
    Aug 31, 2020
    Posts:
    1
    the best way is to copy cmdline-tools, but it also build projects with Tools directory copied from Unity 2021.3.0
     
  31. ffdev78

    ffdev78

    Joined:
    Dec 18, 2020
    Posts:
    8
    It worked like a charm, thanks so much! I guess they'll submit an update soon, this is an embarrassing bug actually :)
     
  32. StartStart

    StartStart

    Joined:
    Jan 2, 2013
    Posts:
    147
    Thank you, this thread help me.

    //

    In case anyone confuse which folders to copy.

    This is folder path to copy.

    upload_2022-7-15_21-11-58.png
     
  33. niyazimustafabozkurt

    niyazimustafabozkurt

    Joined:
    Aug 24, 2018
    Posts:
    9

    GOOD WORKS
     
    hkenanc likes this.
  34. FURKANKAHVECI

    FURKANKAHVECI

    Joined:
    May 12, 2013
    Posts:
    24
    just because of this problem it said my android keystore password is wrong.
    Copy files to created Tools folder works. Thanks.
     
    hkenanc and shinichikudo997 like this.
  35. hkenanc

    hkenanc

    Joined:
    Jun 5, 2020
    Posts:
    1
    Thank you,
    This solution worked for me.
     
  36. kole_dole

    kole_dole

    Joined:
    Jul 8, 2018
    Posts:
    8

    Thank you,
    This worked for me.
     
  37. KizanAxe

    KizanAxe

    Joined:
    Jul 1, 2020
    Posts:
    1
    I think this will do it.

    mkdir "C:\Program Files\Unity\Hub\Editor\2021.3.6f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools"

    xcopy "C:\Program Files\Unity\Hub\Editor\2021.3.6f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\cmdline-tools\2.1\*.*" "C:\Program Files\Unity\Hub\Editor\2021.3.6f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools" /e /q /z
     
    Last edited: Jul 25, 2022
    MarkHelsinki likes this.
  38. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    3,477
    Here is a visual guide on solving the issue:
     
    Jodette likes this.
  39. AndyKorth

    AndyKorth

    Joined:
    Oct 19, 2009
    Posts:
    34
    This is a problem for me too, I hope it gets fixed soon. Maybe part of making a new version of Unity could include testing if android builds work?
     
    rozochkin13 likes this.
  40. SophiaKramer

    SophiaKramer

    Joined:
    Feb 14, 2016
    Posts:
    9
    That worked, and then I got the following error:

    FileNotFoundException: Failed to find $C:/Program Files/Unity/Hub/Editor/2021.3.6f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\GradleTemplates\gradleTemplate.properties


    And I'm wondering if it has anything to do with there being both "/" and "\" in the path. It doesn't seem right.
     
  41. bassarisse

    bassarisse

    Joined:
    Jun 13, 2018
    Posts:
    3
    I don't know if anything was fixed on Unity's side, but I also didn't have the Tools folder. However, today I reinstalled the 2021.3.6 Editor, and then there it was: the Tools folder was placed correctly on expected path!
     
    FURKANKAHVECI likes this.
  42. Zeeppo-Games

    Zeeppo-Games

    Joined:
    May 13, 2015
    Posts:
    62
    No, it hasn't been fixed. Almost 3 weeks now. I'm really glad at least this is the LTS version... what a joke.
     
    IgorBoyko and FURKANKAHVECI like this.
  43. alliexpdx

    alliexpdx

    Joined:
    Jul 24, 2022
    Posts:
    1
    I just upgraded and experienced the same issue -- this thread fixed it - thanks!

    Just in case it helps someone as mine was in one extra nested folder deeper, so I had to create the \Tools folder like described by Zeeppo-Games under .\AndroidPlayer\ and copy the contents of:

    ...\Unity\Hub\Editor\2021.3.6f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\cmdline-tools\2.1\*

    To:
    ...Unity\Hub\Editor\2021.3.6f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\*
     
    voidraizer and FURKANKAHVECI like this.
  44. kcastagnini

    kcastagnini

    Joined:
    Dec 14, 2019
    Posts:
    60
    Unity 2021.3.6f1 in one of the worst releases ever.
    My first issue was that nested Canvases are broken, and now this.
     
  45. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    485
    Despite being known to be broken, 2021.3.6f1 has never been retracted (revoked) from downloads, since July 8th. So you cannot even install the stable version from Unity Hub because it only lists the latest release.
     
  46. Zeeppo-Games

    Zeeppo-Games

    Joined:
    May 13, 2015
    Posts:
    62
    1 more 2022 version today. 3 updates in the non LTS version since the last LTS update. This is ridiculous.
     
  47. Zeeppo-Games

    Zeeppo-Games

    Joined:
    May 13, 2015
    Posts:
    62
  48. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    485
    I know I can use download archive; but isn't that the whole point of Unity Hub — to provide a link to the latest stable LTS?
     
  49. Zeeppo-Games

    Zeeppo-Games

    Joined:
    May 13, 2015
    Posts:
    62
    Yes, and it does. Even if the stable version is not stable at all :D
     
  50. kcastagnini

    kcastagnini

    Joined:
    Dec 14, 2019
    Posts:
    60
    Time to get back to 2019.4 then I guess