Unable to locate Android SDK

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:

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 :


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 :

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.

I hope someone can help on that .
Thanks

same issue

Yeah, this is a joke. They just don’t give a shit

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 :slight_smile:

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?

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.

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.

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

In Android Studio you have to deselect “hide obsolete packages” and then to install Android SDK Tools (Obsolete).

8 Likes

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

@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?

Thank you very much

Thanks A Ton.Really Works.Try This Before Anything …

After 4 hours of struggling and looking this worked. Thank you so much. Please use this info it is priceless!

Mine is 20th time. It’s horrible how unity’s android build is planned.

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!

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.

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! :slight_smile:

@Kieran-Brown everyone that was having issues above had already installed them both that way.

where is that menu? In unity?
I have problems too making it work :confused: