Search Unity

Unable to locate Android SDK

Discussion in 'Android' started by Zukka, Oct 3, 2019.

  1. Zukka

    Zukka

    Joined:
    Feb 28, 2016
    Posts:
    4
    Hello everybody,
    I have some problems with my Android Build.
    After I click "Build" button I immediately get this message"Unable to locate Android SDK" and
    "Run Device" field tells Android SDK/JDK directory is not set (light- grey text).
    I followed many threads and tutorial but I really can't go on..I don't understand what is happening:

    unable_to_locate_sdk.jpg

    I've downloaded Unity by HUB, version 2019.2.7f2 with full Android Modules (Parent and Child) and they seem to be installed correctly looking at Pref>ExternalTools> Android tab :
    External_Tools_Set_up.jpg
    I also tried to uncheck the boxes and give the Directory by Browse button but nothing change.

    Android "Icon" is also shown on the left-bottom corner in HUB> Installs.

    I followed the directory where they are installed..and they are there :

    Sdk-installed-directory.jpg

    It also doesn't recognize my mobile Xiaomi Redmi Note 7 ( "Developer" active and "Debug" enabled )..but I cannot say if it is related to my "main" SDK problem.

    Device_not_recognized.jpg

    I hope someone can help on that .
    Thanks
     
  2. cookthatgame

    cookthatgame

    Joined:
    Sep 14, 2019
    Posts:
    1
    same issue
     
  3. JJ_FX

    JJ_FX

    Joined:
    Mar 19, 2015
    Posts:
    76
    Yeah, this is a joke. They just don't give a S***
     
  4. Zukka

    Zukka

    Joined:
    Feb 28, 2016
    Posts:
    4
    Hello Guys..I solved it some days ago.
    It turned out that those files were installed,they were showed but not "recognized" for some reasons i don't know.
    I installed 2019.2.7f2 and everything worked.
    Pay attention to select modules (Parent and Child folder) when you download it from HUB
    Now it works very well and I solved all problems in one shot :)
     
  5. NexxeN_Games

    NexxeN_Games

    Joined:
    Dec 19, 2019
    Posts:
    1
    Still having the same issue, I checked everything, tried using SDK from the official site, tried just using the command line tools only, tried unity 2018, 2019.2, 2019.2.7f2 as you said, tried 2019.3, 2020 alpha, tried open JDK manually, tried JDK from oracle website, tried this, tried that and no success, what could I be doing wrong?
     
  6. wirelessdreamer

    wirelessdreamer

    Joined:
    Apr 13, 2016
    Posts:
    134
    I had working unity installs of multiple versions that I could successfully build with yesterday. I force killed unity yesterday to cancel a build, and I'm seeing this issue now. I've been unable to get back to a good state yet.
     
  7. wirelessdreamer

    wirelessdreamer

    Joined:
    Apr 13, 2016
    Posts:
    134
    I got my issue resolved, I'm not sure how much of this is voodoo, and how much is the solution though. After uninstalling unity, i purged some other older versions i had through hub, then i went to the install path in hub, and cleared out some stale files. Then i changed the install path for editors to another location (I was running out of space anyway). During the process I purged my library on the project as well, and edited the modules file in C:\Program Files\Unity\Hub\Editor\unityversion\modules.json to say nothing with android was installed. I'm not sure what the solution was exactly, just that i can build again.
     
  8. Deleted User

    Deleted User

    Guest

    This is about the 5th time in total that I have a hard time to get android working with Unity. Running 2018.4.19f1 and simply installed Android Studio with quite a couple of SDKs now.
    The selection process always fails with "Unable to locate Android SDK"
    I don't know why, I don't know what it's looking for exactly.... If I knew how to debug this I'd be glad to do it, but just this error is not helpful
     
  9. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    836
    In Android Studio you have to deselect "hide obsolete packages" and then to install Android SDK Tools (Obsolete).
     
  10. Deleted User

    Deleted User

    Guest

    Thanks,
    Initially I did that. did not work. I then downgraded to version 25. did not work. Then I tested a little with a new project, simple buildpipeline with platform switching and such, that all worked. THEN I went back to logging the SDK path in my original project prior to the actual BuildPlayer call (commented that one out) and the path was correct. I then removed the version 25 tools and installed the ones from Android Studio again.
    NOW the build works... no idea why
     
  11. Deleted User

    Deleted User

    Guest

    @JuliusM I was too early to comment. When I run my batch command from the server that builds the project, the Android SDK path is set and it works.
    However, when I run the batch from Azure DevOps Pipeline, the SDK path is empty. Do you know where the path is saved and what could possibly override it?
     
  12. nallaperumal

    nallaperumal

    Joined:
    Jun 1, 2019
    Posts:
    1
    Thank you very much
     
  13. ghanshyambista7

    ghanshyambista7

    Joined:
    Mar 30, 2020
    Posts:
    5
    Thanks A Ton.Really Works.Try This Before Anything ....
     
  14. coldyca

    coldyca

    Joined:
    Apr 24, 2020
    Posts:
    1
    After 4 hours of struggling and looking this worked. Thank you so much. Please use this info it is priceless!
     
  15. vive_creative

    vive_creative

    Joined:
    Mar 22, 2019
    Posts:
    12
    Mine is 20th time. It's horrible how unity's android build is planned.
     
  16. vive_creative

    vive_creative

    Joined:
    Mar 22, 2019
    Posts:
    12
    Actually, Unity's decision to encapsulate all android related build tools inside Hub is a good move. But it could only be fruitful if Hub works. Most of the time, it doesn't update or install modules. Installing external tools, SDK, NDK & Gradle is going to be a pain! with very little certainty of it working!
     
  17. wirelessdreamer

    wirelessdreamer

    Joined:
    Apr 13, 2016
    Posts:
    134
    I've been using 2019.3.14f1, and having no android build issues with it. Targeting both mobile and quest. . . Unless you count sometimes having to randomly platform switch from android to windows, and back again to get builds to finish.
     
  18. Kieran-Brown

    Kieran-Brown

    Joined:
    Oct 29, 2019
    Posts:
    3
    I had this problem but fixed it in the most simple way nobody ever thinks of... I opened the hub (using 2.1.0), went to installs, selected the options on the install (using 2019.2.1f1), and I selected "add modules", I clicked the "android build support" drop down and selected "Android SDK and NDK tools" as well as "OpenJDK ", clicked "next" and it installed, booted Unity back up and I can build now. Yay! :)
     
  19. wirelessdreamer

    wirelessdreamer

    Joined:
    Apr 13, 2016
    Posts:
    134
    @Kieran-Brown everyone that was having issues above had already installed them both that way.
     
  20. RuneShiStorm

    RuneShiStorm

    Joined:
    Apr 28, 2017
    Posts:
    264

    where is that menu? In unity?
    I have problems too making it work :/
     
  21. mariemdhaouad98

    mariemdhaouad98

    Joined:
    Feb 13, 2022
    Posts:
    1
    thanks , me too
     
  22. xevenpublicidad

    xevenpublicidad

    Joined:
    Nov 27, 2018
    Posts:
    1
    Fantastic Response, this is the best Solution
     
  23. xXWarmachineRoXx

    xXWarmachineRoXx

    Joined:
    Sep 28, 2019
    Posts:
    3
    doesn't work

    tried everything

    Won't uninstall unity for now but might resort to it

    help!