Android SDK not found

Hi,

I’ve made a fresh install of Unity 2019.2.9f1 using the Hub on my Linux Mint 19.1.
In the process, I’ve checked then Android SDK installation as well.

I’ve tried to use Unity Remote to test my project, but it just doesn’t works.
I’ve followed some tutorials describing what to do step by step, with no luck. And it seems I’m not alone on that topic… Nevermind…

So I’ve tried to fallback to a plain simple Build to test my game… and it doesn’t works as well !

As explained here Unity - Manual: Android environment setup
The Android SDK seems to be properly installed in the right path.
In my case : “/home/alesk/Unity/Hub/Editor/2019.2.9f1/Editor/Data/PlaybackEngines/AndroidPlayer”

But when I try to build it, I’ve got these error messages :

UnityException: Android SDK not found
Unable to locate Android SDK.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at /home/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
Build completed with a result of 'Failed'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at /home/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x00242] in /home/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:190
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x0007f] in /home/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:95
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at /home/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

It seems that the problem is somehow related to IMGUI, but I couln’t find the file "GUIUtility.cs" anywhere on my computer.

I’ve also tried to Build a fresh new empty project, and I have the same errors.

If someone has some clues on how to fix that… I would be more than happy :wink:

2 Likes

Same here, tried manually installing Android SDK and NDK-16b and setting the path in Unity Preferences but no luck…

1 Like

Hi,

I’ve also have been getting this issue with Unity 2019.2.8f1 (Hub 2.1.2, Ubuntu 18.04). The SDK appears to be installed in the correct path (~/Unity3d/Unity/Editors/2019.2.8f1/Editor/Data/PlaybackEngines/AndroidPlayer/SDK)

Building gives me these errors :

UnityException: Android SDK not found
Unable to locate Android SDK.
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun() (at /home/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:122)
Build completed with a result of 'Failed'
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun() (at /home/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:122)
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x00242] in /home/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:190
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x0007f] in /home/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:95
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun() (at /home/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:122)
1 Like

I have the same problem…

1 Like

Please check if there is “tools” folder in Unity/Hub/Editor//Editor/Data/PlaybackEngines/AndroidPlayer/SDK/. If the folder is not there, then you can download Android SDK from Google and copy that folder after unzipping the SDK into Unity’s folder.

Hope that helps.

Yes this folder is there…

Hmm… Last time the “tools” folder wasn’t installed by Unity and that was the case for the SDK not found problem. If everything is installed properly (SDK, NDK and Java), then perhaps try comparing the SDK files downloaded from Google and the ones in the Unity folder? I no longer download the SDK/NDK supplied by Unity as I have multiple Unity versions installed so it’s just easier to have Unity to use my system wide SDK/NDK to save space.

“tools”, “build-tools” or “platform-tools” ?

I have 3 folders here :
“build-tools”
“platforms”
“platform-tools”

But not “tools” only

“tools” only. This folder is with the official SDK from Google, but somehow Unity didn’t include it with their SDK package.

Upgraded to 2019.2.10f1 and I copied the “tools” folder from an Android SDK installation to PlaybackEngines/AndroidPlayer/SDK/ but didn’t help. Still getting “Android SDK not found”.

Another maybe related issue: when I go to Preferences to edit Android SDK location I get this error to console on every button press:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.Android.SDKManager..ctor () (at <24d9b022aa584914af833273ea899103>:0)
UnityEditor.Android.SDKManager.GetInstance () (at <24d9b022aa584914af833273ea899103>:0)
UnityEditor.Android.AndroidPreferenceWindowExtension.WritePreferences () (at <24d9b022aa584914af833273ea899103>:0)
UnityEditor.PreferencesProvider.WritePreferences () (at /home/builduser/buildslave/unity/build/Editor/Mono/PreferencesWindow/PreferencesSettingsProviders.cs:818)
UnityEditor.PreferencesProvider.ApplyChangesToPrefs (System.Boolean force) (at /home/builduser/buildslave/unity/build/Editor/Mono/PreferencesWindow/PreferencesSettingsProviders.cs:535)
UnityEditor.PreferencesProvider.ShowExternalApplications (System.String searchContext) (at /home/builduser/buildslave/unity/build/Editor/Mono/PreferencesWindow/PreferencesSettingsProviders.cs:381)
UnityEditor.PreferencesProvider.OnGUI (System.String searchContext, System.Action`1[T] drawAction) (at /home/builduser/buildslave/unity/build/Editor/Mono/PreferencesWindow/PreferencesSettingsProviders.cs:307)
UnityEditor.PreferencesProvider+<CreateExternalToolsProvider>c__AnonStorey1.<>m__0 (System.String searchContext) (at /home/builduser/buildslave/unity/build/Editor/Mono/PreferencesWindow/PreferencesSettingsProviders.cs:210)
UnityEditor.SettingsProvider.OnGUI (System.String searchContext) (at /home/builduser/buildslave/unity/build/Editor/Mono/Settings/SettingsProvider.cs:103)
UnityEditor.SettingsWindow.DrawControls () (at /home/builduser/buildslave/unity/build/Editor/Mono/Settings/SettingsWindow.cs:322)
UnityEditor.SettingsWindow.DrawSettingsPanel () (at /home/builduser/buildslave/unity/build/Editor/Mono/Settings/SettingsWindow.cs:313)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize) (at /home/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:298)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at /home/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:483)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e) (at /home/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:466)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at /home/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:447)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /home/builduser/buildslave/unity/build/Modules/UIElements/Events/MouseCaptureDispatchingStrategy.cs:93)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /home/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:280)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at /home/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:156)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at /home/builduser/buildslave/unity/build/Modules/UIElements/Panel.cs:190)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at /home/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:255)
UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /home/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:78)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /home/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
1 Like

I found a solution that works for me. I made yet another installation of Android SDK and NDK with Android Studio and set those to Unity preferences and then they were accepted by Unity.

1 Like

It looks like it is a general issue, there is an issue reported already: Unity Issue Tracker - [Linux] Unity Hub sets up Android SDK, NDK and JDK incorrectly on Linux

Maybe one of the workarounds mentioned there will help you.
If you can, maybe voting for the issue can also help.
Either way, there should be a way to make it work.

the furthest I can get is when building with il2cpp I get Failed running /opt/Unity/2019.2.17f1/Editor/Data/il2cpp/build/il2cpp.exe with various *.o files giving Native error= Access denied

with another error line spitting out Exception: /opt/Unity/2019.2.17f1/Editor/Data/il2cpp/build/il2cpp.exe did not run properly!

I have tried running as root as well as changing user/group permissions on both the editor and the project folders

I am also unable to get the SDK that is delivered with Unity working, its the SDK from the android package manager. But the NDK from the package manager doesnt work, so I have it pointing to the one that comes with unity.

linux support is still very messy and its disappointing that I have to run a win10 vm just to get a packaged build to work

@RetroZelda_1
I got the same experience with NDK and SDK provided by Unity on Linux, more here(for NDK):

Bottom line, there are permission issues with NDK provided by Unity(and maybe more things).

For now the only solution is to not use it and download libraries separately.

After ~4 hours of trying to get the UnityHub version working, waiting for downloads, reimports, etc, I pointed it at my local install and it worked just fine. (Whatever the latest version the SDK the Ubuntu package for Android Studio installed.)

Annoyingly, I was about to put in the paths for this when my co-worker strongly advised my to let Unity install it, as I would likely have problems to no end if I let Unity do it. (facepalm) Oh well, hindsight is 20/20.

Two versions of unity both time with the “android module” checkbox checked, tried every folder from either my sdks (apt-get / downloaded from https://developer.android.com/studio/releases/sdk-tools extracted in an AndroidPlayer/SDK folder) and I’m giving up… So much time lost :frowning:

2 Likes

Hi guys,
I had the same problem and I solve it, I have to say that i am working on windows, but i think this will work for ubuntu too.
First of all, you download from the android studio page, at the end of the page you will have the zips with the sdk packages, download it, after unziping it you will see that it’s only a folder inside called tools.
then in unity, in preferences, you have to put the path to this folder or to the upper directory.
then you go to build settings and click on build.
after this you will have to click on update while its building the apk.
After this it will work.

3 Likes

Although everyone seems to be talking about Unity 2019, the title says “Android SDK not found”, so I try too.
I’m running 2018.4.19f1. Building Android from the editor, works. building via commandline does not. Since the error only says:

DisplayProgressbar: Detecting Android SDK
UnityException: Android SDK not found
Unable to locate Android SDK.

How Do I know where Unity is even trying to look for the right version? It’s correctly set and usable in the Editor preferences but refuses to be found from CommandLine

I just was able to find the Android SDK using Command-Line-Tools.
Inside the ‘Android-sdk’ folder (or whatever name you give it) you should have the following folders : build-tools, platforms, platform-tools and tools.

I renamed the folder ‘command-tools’ to just ‘tools’ and my “Android SDK not found” problem was solved.
Hope it is of help

after this you will have to click on update while its building the apk. - can you elaborate on this? What do you mean by clicking on update?