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. Dismiss Notice

Unity can't find Android SDK

Discussion in 'Android' started by EmergencBattle, Nov 22, 2017.

  1. EmergencBattle

    EmergencBattle

    Joined:
    Feb 11, 2017
    Posts:
    2
    In Android Studio in the SDK manager the path to the SDK is listed under D:\Programs\AndroidSDK2, I copied the path into Unity but it still can't find the Android SDK. I realise similar threads have been made suggesting that you put a path similar to C:\Users\%Username%\AppData\Local\Android into Unity, but I already tried with that path and that also didn't work. I get the following error:

    CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
    D:\Programs\JDK\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="D:/Programs/AndroidSDK2\tools" -Dfile.encoding=UTF8 -jar "D:\Programs\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

    stderr[
    Error:Invalid command android
    ]
    stdout[

    ]
    exit code: 64
    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEngine.GUIUtility: ProcessEvent(Int32, IntPtr)

    Is it because it's on the D: drive? I really don't want to put it on my C: drive if it can be at all avoided because it's getting pretty full.
     
  2. Evaldas_Unity

    Evaldas_Unity

    Unity Technologies

    Joined:
    Jun 23, 2016
    Posts:
    69
    Unity version? SDK version? JDK version?

    If you're on older Unity version, but on newest SDK, it possibly won't work:
    https://issuetracker.unity3d.com/is...-android-sdk-tools-25-dot-3-1-version-is-used

    Also, newest JDK (9) won't work (but from the log it doesn't look like that's the issue).:
    https://issuetracker.unity3d.com/is...jdk-and-unable-to-list-target-platforms-error
    If you have java JDK9, downgrade to JDK8.

    Also make sure there is an 'android.bat' file in your 'D:/Programs/AndroidSDK2/tools/' directory.
    Unlikely, but maybe you have an overaggressive antivirus : P


    I myself use SDK from 'D:/Android/sdk/' path, and it works fine.
     
    EmergencBattle likes this.
  3. EmergencBattle

    EmergencBattle

    Joined:
    Feb 11, 2017
    Posts:
    2
    Thank you, following these steps worked, although for anyone reading this I could not find the Android tools folder on the download page specified in the issue tracker, but I found them quickly enough by googling them.
     
  4. cyenketswamy

    cyenketswamy

    Joined:
    Jul 24, 2015
    Posts:
    41
    Android Build Not Working

    My Unity project contains a Main Camera, Directional Light and a Cube and i am trying to build this into an apk installer for Android without any success for the last TWO WEEKS. I've did Android apk builds previously in Unity 5 but the current version of Unity just doesn't work. What is going wrong????

    Information

    I have Unity Version: 2017.3.0f3 Personal
    I have Android Studio 3.1 Installed. I have installed system images and Platforms for API 22.

    In the Player build settings within Unity i have specified
    Minimum API Level: Android 5.1'Lollipo' (API level 22)
    Target API Level: Android 5.1 'Lollipop' (API level 22)

    For Edit/Preferences/ExternalTools, in Unity i have

    SDK PATH
    C:\Users\UserName\AppData\Local\Android\Sdk

    JDK PATH
    C:\Program Files\Java\jdk-9.0.4\

    I have tried jdk1.7.0_25 no success

    NDK PATH:
    C:\Users\UserName\Downloads\android-ndk-r13b-windows-x86_64\android-ndk-r13b

    When i attempt to build the project i get the message

    Detecting Android SDK
    Unable to List Target Platforms. Please make sure the Android SDK path is correct. See the Console for details.

    Console Details:

    CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct.
    C:\Users\UserName\AppData\Local\Android\Sdk\tools\bin\avdmanager.bat list target -c
    stderr[
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
    at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
    at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
    at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
    at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:213)
    at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
    Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
    at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
    ... 5 more
    ]
    stdout[
    ]
    exit code: 1
    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.AndroidSDKTools.RunAndroidSdkTool (System.String toolName, System.String arguments, Boolean updateCommand, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.AndroidSDKTools.ListTargetPlatforms (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit)
    UnityEditor.Android.AndroidSDKTools.GetTopAndroidPlatformAvailable (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKPlatformDetector.GetVersion (UnityEditor.Android.AndroidSDKTools sdkTools)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKComponentDetector.Detect (UnityEditor.Android.AndroidSDKTools sdkTools, System.Version minVersion, UnityEditor.Android.PostProcessor.ProgressHandler onProgress)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (System.Version minVersion, UnityEditor.Android.PostProcessor.Tasks.SDKComponentDetector detector)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (Int32 minVersion, UnityEditor.Android.PostProcessor.Tasks.SDKComponentDetector detector)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
    Max436 likes this.
  5. reedny

    reedny

    Joined:
    Mar 4, 2017
    Posts:
    57
  6. cyenketswamy

    cyenketswamy

    Joined:
    Jul 24, 2015
    Posts:
    41
    I will wait for Unity to be compatible with JDK9. For now at least my project is working on Unity 5.
     
  7. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,128
    You're going to be waiting for a very long time. This isn't a problem with Unity. This is a problem with Android itself. Android only fully supports JDK 7 with a subset implementation of JDK 8. Android has no support for JDK 9 at all.

    https://developer.android.com/studio/write/java8-support.html
    https://stackoverflow.com/questions...udio-3-support-java-9-for-android-development
    https://stackoverflow.com/questions...between-os-version-api-level-and-java-version
     
    Last edited: Apr 7, 2018
    JuliusM likes this.
  8. DrMasseussStudios

    DrMasseussStudios

    Joined:
    Oct 29, 2017
    Posts:
    1
    I tried moving to Java 8 and I am still getting the same issues of not being able to find the SDK

    CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct.
    C:/Users/DrMas/AppData/Local/Android/Sdk\tools\bin\avdmanager.bat list target -c
    stderr[
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
    at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
    at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
    at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
    at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:213)
    at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
    Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
    at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
    ... 5 more
    ]
    stdout[
    ]
    exit code: 1
    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.AndroidSDKTools.RunAndroidSdkTool (System.String toolName, System.String arguments, Boolean updateCommand, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.AndroidSDKTools.ListTargetPlatforms (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit)
    UnityEditor.Android.AndroidSDKTools.GetTopAndroidPlatformAvailable (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKPlatformDetector.GetVersion (UnityEditor.Android.AndroidSDKTools sdkTools)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKComponentDetector.Detect (UnityEditor.Android.AndroidSDKTools sdkTools, System.Version minVersion, UnityEditor.Android.PostProcessor.ProgressHandler onProgress)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (System.Version minVersion, UnityEditor.Android.PostProcessor.Tasks.SDKComponentDetector detector)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (Int32 minVersion, UnityEditor.Android.PostProcessor.Tasks.SDKComponentDetector detector)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  9. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    824
    Try these steps. Depending on what's wrong with your setup, just the first one might be enough, however if that does not help, try other steps as well.
    1) Make sure java path in the Unity editor points to jdk8.
    2) If you have JAVA_HOME environment variable, make sure it points to jdk8.
    3) Check your path environment variable to make sure jdk8 path is used there (not jdk9 or jdk10).
    4) Try restarting Unity editor and your computer.
     
    onur84 likes this.
  10. LarryTheBrave

    LarryTheBrave

    Joined:
    Nov 20, 2016
    Posts:
    24
    Try telling Unity in the Preferences to use the Android SDK that Unity provides (recommended).
    Using an SDK from elsewhere, even the official one with Android Studio, seems to cause trouble.
     
  11. crogersarvr

    crogersarvr

    Joined:
    Jun 5, 2019
    Posts:
    7
    Ive used unity to install the android package from unity for my version of unity but unity still doesnt find it when i build. I think it has something to do with hub that has installed itself in 2 places, it wont recognize the android package i just installed. hub is sketchy.
     
  12. RiccardoAxed

    RiccardoAxed

    Joined:
    Aug 29, 2017
    Posts:
    119
    Hi, I'm completely stuck with this issue too.

    I'm using Unity 2019.2.13, even if I've the same problem with 2019.2.16, anyway when I open whatever Android project (both existing or brand new), I've this warning first:

    Failed getting available Android API levels. Could not find Android SDK Tools.
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)


    Then, when I try to build it, I have a "Unable to locate Android SDK" error:

    AndroidSDKerror.png

    When I close the dialog, I've these errors:

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


    By default, in my preferences I've the "SDK/JDK/NDK installed with Unity" options checked, anyway the error doesn't disappear even if I use a path to another SDK folder, both from different Unity version I've installed or from Android Studio installation.

    In my thousand attempts I managed to build the apk just once, in 2019.2.13 editor, just using the SDK path to the 2019.3.0 folder, but after that the error came back.

    I also tried to reinstall Unity 2019.2.13, to switch to 2019.2.16 and to delete the Library folder in my project (but as already said, the error pops up even on a brand new Android project) without any success.

    I'm attaching two editor logs, the first is when I opened the project after unistalling/reinstalling Unity and trying to build, the second is the log I've at every build attempt.

    Hope someone can help me with this issue that is completely blocking me.
     

    Attached Files:

  13. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    824
    Hi, in the second log it states that SDK was not found (probably what you've seen at first and during some of the other runs), however in the first log the SDK was found, but running sdkmanager has failed with a "Warning: File C:\Users\Riccardo\.android\repositories.cfg could not be loaded.". Try to create an empty file "C:\Users\Riccardo\.android\repositories.cfg". Make sure it has the cfg extension, not a txt or any other.
     
  14. RiccardoAxed

    RiccardoAxed

    Joined:
    Aug 29, 2017
    Posts:
    119
    Hi, and thank you for your answer.

    I saw that error and already tried to create such a file, and I tried again right now (text file with name and extension changed to "repositories.cfg") but it didn't solve the issue.

    AndroidFolder.png

    The first log happens just once, when I uninstall and install the editor again, then launching the first build. From then on, at avery build attempt I've just the second log with the Android SDK error.
     
  15. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    824
    Does this also happen if you deselect "Installed with Unity" and point the SDK path to the existing SDK installation?
     
  16. RiccardoAxed

    RiccardoAxed

    Joined:
    Aug 29, 2017
    Posts:
    119
    Yes, it happens with every SDK path, both from different Unity installation or Android Studio.

    Anyway, in the end I managed to build an apk without errors, but in a very twisted and unstable way. I'm listing the steps I followed, maybe it can help to better understand it.

    As I said, adding the file repositories.cfg in the android folder didn't solve the issue so, after creating the file, I unistalled and installed Unity again, then when I tried to build I'd the log in attachment, with a "Can't find C:/Program Files/2019.2.13f1/Editor/Data/PlaybackEngines/AndroidPlayer\SDK\tools\bin\sdkmanager.bat". So:

    - First I copied/pasted sdkmanager.bat in the above folder, picking it from a working Unity installation on another pc.

    - This time Unity finds the SDK but can't find the NDK, so I'd to copy the whole content of folder C:\Program Files\2019.2.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\android-ndk-r16b" in the parent folder "...\NDK".

    Following these steps the build had success but, even so, if I close the editor and open the project again, the file sdkmanager.bat is somehow deleted, so I've to copy/paste it again in the above folder, otherwise the SDK issue pops up again.

    Hope it can help to find a more rational solution.
     

    Attached Files:

  17. d20kev

    d20kev

    Joined:
    Jul 19, 2019
    Posts:
    16
    went through all your repro steps, didnt change for me, i still get unable to locate ndk
    im on 2019.2.1f1
    i also have this now...

    UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
    at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x00242] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:190
    at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x0007f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:95
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    im dead in the water. Ive been at this for 5 days straight and cant get past it...
     
  18. RiccardoAxed

    RiccardoAxed

    Joined:
    Aug 29, 2017
    Posts:
    119
    The problem with the NDK is usually easier to solve than the SDK issue, I met it a couple of times and as I said I solved it just copying the whole content in the parent root, following some hints from other users. So, your NDK folder should look like this:

    NDK_Folder.jpg

    Anyway, mine was just a makeshift, and in the end I didn't solve the SDK issue at all, so I'm still stuck with it.

    At least, in my case I believe the root of the problem is that for some unknown reason the file sdkmanager.bat is automatically erased from the "...\SDK\tools\bin\" folder, giving rise to the errors chain. No matter how many times I paste it again in the "tools\bin" folder, I can see it disappear in a second. It is automatically deleted even if I copy it on the desktop, while I can copy it in a subfolder created by me with no problem at all.

    I guess it's some sort of security/permissions problem related to the potentially dangerous nature of a bat file, but anyway if I copy it in the aforesaid folders with its name changed (i.e. "sdkmanager_.bat") it's not deleted, so it seems strictly related with its file name.

    I hope some other forum user or Unity guy can give us some more hints, it's two days I'm completely blocked on this.
     
  19. RiccardoAxed

    RiccardoAxed

    Joined:
    Aug 29, 2017
    Posts:
    119
    I tried to update Unity to 2019.2.17 but it's useless.

    At first build, it failed and the file sdkmanager.bat from the installation disappeared again, then I tried anyway to make a build but it failed again because of the NDK not found. I made the usual copy/paste in the NDK folder and this time the build succedeed.

    After that, I closed and opened the editor to check if the issue was definitely gone, but the build failed again. Then I pasted the sdkmanager.bat in the "...SDK/tools/bin" - where it was previously deleted - and, who knows why, this time it's not deleted (so far), but the build failed anyway with a different error:

    Errore: impossibile trovare o caricare la classe principale com.android.sdklib.tool.SdkManagerCli
    CommandInvokationFailure: Failed to update Android SDK package list.
    C:/Program Files/2019.2.17f1/Editor/Data/PlaybackEngines/AndroidPlayer\SDK\tools\bin\sdkmanager.bat --list
    stderr[
    Errore: impossibile trovare o caricare la classe principale com.android.sdklib.tool.SdkManagerCli
    ]
    stdout[
    ]
    exit code: 1
    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.SDKManager.UpdatePackagesList () (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.SDKManager.HighestVersionInstalled (UnityEditor.Android.SDKManager+Component tool) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKToolsDetector.GetVersion () (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKComponentDetector.Detect (System.Version minVersion, UnityEditor.Android.PostProcessor.ProgressHandler onProgress) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (System.Version minVersion, UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKComponentDetector detector) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <502f1b7df2d7430696af84c6f02852ed>:0)
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
    Build completed with a result of 'Failed'
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
    UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
    at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x00242] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:190
    at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x0007f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:95
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)


    I attached a new full editor log about this last build.

    It's a nightmare... :(
     

    Attached Files:

  20. RiccardoAxed

    RiccardoAxed

    Joined:
    Aug 29, 2017
    Posts:
    119
    Tried a new 2019.2.13 install, the issue with the "vanishing" sdkmanager.bat seems to be stopped, anyway the Android builds still fail with the following error:


    Errore: impossibile trovare o caricare la classe principale com.android.sdklib.tool.SdkManagerCli
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
    CommandInvokationFailure: Failed to update Android SDK package list.
    C:/Program Files/2019.2.13f1/Editor/Data/PlaybackEngines/AndroidPlayer\SDK\tools\bin\sdkmanager.bat --list


    The Player Settings/API levels just display "Getting API levels...". I've Java 8 update 231 installed.
    I'm also attaching the full editor log of my last build attempt.

    Please, give us some sign of life...
     

    Attached Files:

  21. d20kev

    d20kev

    Joined:
    Jul 19, 2019
    Posts:
    16
    Issues with this are all over the forums. Unity has to be on top of it, that's all i can hope. if i make any headway ill let you know, if you figure something out, please let me know as well. :)
     
    jtachikawa likes this.
  22. MaxBackcountry

    MaxBackcountry

    Joined:
    Jan 24, 2014
    Posts:
    9
    In my case a newly setup Windows 10 PC seemed to cause the problem as it had environment variables set.

    For me these 2 videos took me on the right track (although they refer to Winows 7 and 8):



    I set the variables:
    JDK_HOME
    JAVA_HOME
    ANDROID_HOME
    SDK_HOME
    NDK_HOME

    But I think already the first 3 variables did the trick.

    In my case apart from that Unity Remote wasn't working. This fixed it:
    https://answers.unity.com/questions/1628598/set-up-android-sdk-path-to-make-android-remote-wor.html

    I mention that because the problems seem to be related...

    Good luck!
     
    RiccardoAxed likes this.
  23. Will_Dev

    Will_Dev

    Joined:
    May 24, 2017
    Posts:
    27
    I am getting the sdk problem as well and Unity is unable to detect the sdk. Is there any solution yet? I am using Unity 2018 and a sdk from android studio
     
  24. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    824
    In Android Studio you have to deselect "hide obsolete packages" and then to install Android SDK Tools (Obsolete).
     
    Wanderer13 and SerializeField like this.
  25. Will_Dev

    Will_Dev

    Joined:
    May 24, 2017
    Posts:
    27
    Yeah I found out. Apparently thy didn't include the tools file so I downloaded that manually. Why is tools obsolete in the first place?
     
  26. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,749
    I have been trying to set up Unity 2018 LTS with Android, and I just could NOT get it working (under Catalina), no matter what permissions or xattr or chmod or sudo or whatever I did with the SDK/NDK.

    In fact, this entire process proved to be one of the most infuriating problems I've dealt with when integrating Android and Unity. Yes, it was more infuriating even than Gradle, if that's even possible. It's ESPECIALLY infuriating because the SDK works 100% with Gradle and Android Studio, but not with Unity. Unity just silently fails to agree that you've given it a valid SDK directory. And yes, I tried installing obsolete tools too, but that did not help.

    What I ultimately ended up doing after dozens of installs and uninstalls, since none of the workarounds actually worked on Catalina, was this:

    - installed Unity2019, which includes tickmarks under the Android module to install NDK and SDK (check these boxes before installing 2019)

    - installed Unity2018 and switched to Android, then ignored its attempts to find the SDK, since they just do not work. Closed Unity2018.

    Next I opened this preferences file (Mac) in XCode:

    ~/Library/Preferences/com.unity3d.UnityEditor5.x.plist
    and then hand-pasted the SDK paths in there.

    The keys you want are:

    AndroidSdkRoot


    and

    AndroidNdkRootR16b


    Set the SDK to the SDK that lives underneath Unity 2019, in my case:

    /Applications/Unity/Hub/Editor/2019.2.17f1/PlaybackEngines/AndroidPlayer/SDK

    I set the NDK to the r16b build I downloaded.

    Finally, do a chmod -w on that plist file to keep Unity from screwing it up every time you close Unity.
     
  27. Deleted User

    Deleted User

    Guest

    This should totally go into the docs. I tried 3 hours since there are no hints to what Unity is actually looking for and accidentally saw this here.
     
  28. karlkarliqwer

    karlkarliqwer

    Joined:
    Apr 21, 2020
    Posts:
    1
    I a issue with the remote controll.
    I use Unity 2019.3 with the recommended SDK but get the Error
    Set-up Android SDK path to make Android remote work in Unity
    Do anyone know the solution?
     
  29. Masked_Riddler

    Masked_Riddler

    Joined:
    Aug 30, 2018
    Posts:
    4
    It's not so much why is tools obsolete, but why is Unity relying on obsolete components like tools to identify the SDK and use it? Shouldn't the Unity Editor have been updated to be compatible with the stable releases so that this kerfuffle doesn't happen?

    This is the solution to Unity not recognising the SDK, by the way - go to Android Studio edit preferences sdk manager, de-select "hide obsolete" and select "show detail", then expand the level 26 sdk and select the "tools" for installation, apply, ok, and boom, your sdk location will be recognised by Unity!
     
  30. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,749
    First off, +1 for correctly spelling that word. I always forget and put an L after the first F... :)

    Second, thanks for the pointer to the 26 tools. At least THAT should be clearly documented anywhere one could turn to do this, like, oh, maybe in the Unity installer!

    Feature request... nay, make that a feature DEMAND to Unity: How about when I tick the install Android checkbox in the installer, Unity puts up a dialog box (copy-paste-able!!!!) and tells me RIGHT IN MY FACE exactly what steps I have to do, what obsolete tools are needed, etc. This has wasted a metric buttload of my time, and I'm just one Unity user. This sorta lossage multiplies across the entire worldwide community and leaves a nasty bad-tasting stain on what people think about Unity.

    I really like Unity and want it to succeed! At least fix the easy stuff, please!
     
  31. SerializeField

    SerializeField

    Joined:
    May 22, 2017
    Posts:
    22
    This solved it for me! Thanks
     
  32. studentvz

    studentvz

    Joined:
    Dec 14, 2014
    Posts:
    149
    Unable to find the Android SDK manager tool. Required Android packages (extra-google-m2repository, extra-android-m2repository) can not be installed. Android SDK path not set. Set the Android SDK property using the Unity "Edit > Preferences > External Tools" menu option on Windows or the "Unity > Preferences > External Tools" menu option on OSX. Alternatively, set the ANDROID_HOME environment variable
    UnityEngine.Debug:LogError(Object)
    GooglePlayServices.ResolverVer1_1:DoResolution(PlayServicesSupport, String, OverwriteConfirmation, Action)
    GooglePlayServices.PlayServicesResolver:Resolve(Action)
    GooglePlayServices.PlayServicesResolver:AutoResolve()
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

    I'm getting this in the following LTS versions: 2017, 2018, 2019. At Unity startup and after apk build which is successful. I can't remove it, even with older tools or new 26.1.1.
     

    Attached Files: