Reputation: 1375
Unity Latest update 2018.3
SDK Tools and Platforms up to date according to SDK Manager.
Trying to build and run Android Build Settings.
After updating the SDK, Unity still asks me to update the SDK by pressing a button built into the software. After I do this it tells me:
Unable to update the SDK. Please run the SDK Manager manually to make sure you have the latest set of tools and the required platforms installed. See console log for details.
When I take a look at the console, it tells me:
CommandInvokationFailure: Unable to update the SDK. Please run the SDK Manager manually to make sure you have the latest set of tools and the required platforms installed.
C:\Program Files (x86)\Android\android-sdk\tempToolsDir\bin\sdkmanager.bat --sdk_root=C:\Program Files (x86)\Android\android-sdk tools platform-tools "build-tools;28.0.3"
stderr[
Error: Failed to find package Files
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
]
stdout[
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
UnityEditor.Android.Command.RunWithStdin (System.Diagnostics.ProcessStartInfo psi, System.String errorMsg, System.Collections.Generic.IEnumerable`1[T] input) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
UnityEditor.Android.AndroidSDKTools.RunAndroidSdkTool (System.String toolName, System.String arguments, System.Boolean updateCommand, System.String errorMsg, System.String toolsDir) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
UnityEditor.Android.AndroidSDKTools.UpdateSDK (UnityEditor.Android.AndroidJavaTools javaTools) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKComponentDetector.Update (UnityEditor.Android.AndroidSDKTools sdkTools, UnityEditor.Android.AndroidJavaTools javaTools, System.Version minVersion, UnityEditor.Android.PostProcessor.ProgressHandler onProgress) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (UnityEditor.Android.AndroidJavaTools javaTools, System.Version minVersion, UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKComponentDetector detector) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
I have updated the SDK manually, it also gave me an error there. I fixed it doing this trick:
Can't update \tools - Android SDK Command Line Tools for Windows
Anyway, I ran Unity with administrator, I ran the cmd with administrator for the manual updates and yet it still wont build. Help needed, thanks.
SCREENSHOT: Unity SDK Update for Android build
Upvotes: 4
Views: 29482
Reputation: 1
Super-simple fix without a need of running external tools to fix issue. It seems like the problem caused by internal parser unable to resolve path with spaces, in my case folder "Program Files", so...
Upvotes: 0
Reputation: 794
I ran into this problem, and fixed it by defining the 'JAVA_HOME' environment variable, which was required for Unity's sdkmanager.bat to run. After this, Unity was able to seamlessly install from within Unity as intended.
Upvotes: 2
Reputation: 31
I fixed this problem by downloading Android SDK tools, downloading the SDK version I wanted, and then dragging that version into the place where Unity stores its SDK versions (if you've downloaded any at all).
I changed my default location for Android but if you find your folder then the versions are under platforms, and you can drag your desired version to:
"C:\ProgramFiles\Unity\Hub\Editor\2020.1.1f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms"
but that path will change depending on the version of Unity you have as well as which drive Unity is stored on. Make sure that in the Unity editor under "preferences>external tools"
you have "Android SDK tools installed with Unity"
turned on. Anyways good luck, I spent hours figuring this out.
Upvotes: 0
Reputation: 550
Android build fails [2019.3.6f1]: Unable to update the SDK
CommandInvokationFailure: Unable to update the SDK. Please run the SDK Manager manually to make sure you have the latest set of tools and the required platforms installed. /Users/yogesh/Library/android-sdk/tempToolsDir\bin\sdkmanager.bat --sdk_root=/Users/yogesh/Library/Android/sdk tools platform-tools "build-tools;28.0.3"
Upvotes: 1
Reputation: 11
What worked for me was to locate the "sdkmanager.bat" folder, start the command prompt with admin rights from there, and enter the following command:
.\sdkmanager "platform-tools" "platforms;android-29"
Upvotes: 1
Reputation: 2269
I had a similar issue trying to update my android sdk and fixed it by running the sdk manager manually. In my Unity Editor console it printed out a long license agreement along with errors telling me what to do.
Firstly, if it does not exist, create an empty repositories.cfg file in your .android folder. For me that file is located at C:\Users\myuser\.android
Next, run the sdkmanager.bat like this in command prompt (your results and path may vary depending on your Unity version).
"C:\Program Files\Unity\Hub\Editor\2019.2.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\bin\sdkmanager.bat" "platforms;android-29"
I was then able to press y and accept the license.
Upvotes: 6
Reputation: 126
Try installing Android SDK into some folder that does not require administrator priviledges to access (something like C:\SDKs\android-sdk
). It worked for me.
Upvotes: 1