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:
    64
    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:
    113
    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:
    113
    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. Alexees

    Alexees

    Joined:
    Nov 8, 2017
    Posts:
    255
    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:
    518
    In Android Studio you have to deselect "hide obsolete packages" and then to install Android SDK Tools (Obsolete).
     
  10. Alexees

    Alexees

    Joined:
    Nov 8, 2017
    Posts:
    255
    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. Alexees

    Alexees

    Joined:
    Nov 8, 2017
    Posts:
    255
    @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
     
unityunity