Search Unity

SDK path is denied Unity 2018.3.5f

Discussion in 'Android' started by soft_sound, Feb 20, 2019.

  1. soft_sound

    soft_sound

    Joined:
    Aug 11, 2012
    Posts:
    39
    Hi, I've been having some trouble getting to my SDK path. I know I had this working a month ago, but I've been setting this up on another computer. I'm not sure why I'm getting this error.

    "UnauthorizedAccessException: Access to the path "C:/Program Files/Android/Android-SDK\tempToolsDir" is denied."

    "Error building Player: UnauthorizedAccessException: Access to the path "C:/Program Files/Android/Android-SDK\tempToolsDir" is denied."

    "Build completed with a result of 'Failed'"

    etc
    upload_2019-2-19_19-43-19.png

    I don't know where this tempToolsDir folder is so it must be hidden. Either way, I'm not sure how to get access to it.

    upload_2019-2-19_19-35-50.png

    I've been trying to update my SDK but I've had no success.
    upload_2019-2-19_19-38-35.png

    I'm currently running android 26 and had updated it from 25
    upload_2019-2-19_19-39-55.png

    So how do I go about solving this?

    If it makes any difference I'm using the embedded JDK.

    I noticed someone else has already posted this as a similar issue in 2019. https://forum.unity.com/threads/problem-with-creating-a-build-for-android.622957/
     
    Last edited: Feb 20, 2019
  2. soft_sound

    soft_sound

    Joined:
    Aug 11, 2012
    Posts:
    39
    Just to make sure I install everything recommended in the docs.

    upload_2019-2-19_22-52-6.png

    I installed 27
    upload_2019-2-19_22-52-32.png

    I pressed Use Highest Installed to finally get it to pick up I had an SDK


    Sadly Android SDK still fails no matter if I try to update it or Use Highest Installed.

    Considering that the manual uses 27 I figured it was safe to use.

    Access is still denied.

    I'm not sure what I'm missing.
    upload_2019-2-19_22-55-26.png
     
  3. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Can you try running Unity as Administrator? (Right click, Run as Administrator)
     
  4. soft_sound

    soft_sound

    Joined:
    Aug 11, 2012
    Posts:
    39
    One of my concerns with that is I run a lot of my software through Unity Hub depending on the client.

    The other issue is running with admin rights just creates a different error message this time.

    upload_2019-2-20_12-35-46.png
     
  5. soft_sound

    soft_sound

    Joined:
    Aug 11, 2012
    Posts:
    39
    Oh here is the error if it helps.


    I tried both the Update Android SDK here - got to 10% before crash.


    Code (CSharp):
    1. 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.
    2. C:/Program Files/Android/Android-SDK\tempToolsDir\bin\sdkmanager.bat --sdk_root=C:/Program Files/Android/Android-SDK tools platform-tools "build-tools;28.0.3"
    I always get much further with the Use Highest Installed before it will soft crash and I won't get any pop-up's about failures, just error messages in the console.

    upload_2019-2-20_12-44-12.png

    Wait...

    Oh it looks like only Use Highest Installed will work on admin, while Update Android SDK always fails at 10%.

    Okay cool. Looks like it's working. Thanks. Kinda extra work when using unity hub though, but as long as I have it working that's all I need.
     
  6. bjornsyse

    bjornsyse

    Joined:
    Mar 28, 2017
    Posts:
    102
    How did you launch Unity as an admin and solved this? Did you launch Unity Hub as an admin? Whenever I try to launch a unity.exe it launches the hub instead...
     
  7. lauhonyeung

    lauhonyeung

    Joined:
    Apr 29, 2017
    Posts:
    30
    same issue here, I don't know how they test this feature, basically useless
     
  8. soft_sound

    soft_sound

    Joined:
    Aug 11, 2012
    Posts:
    39
    I haven't looked at this in a long time but the old way to run unity was to use the .exe and you can still do that. Search Unity and old .exe links should still show, you can right-click them and run them as admin. I think it should still work even with the newer versions of unity. It's kinda hard to catch a good screenshot on windows. But hover your mouse over Unity (check it's the right version by the tooltip that shows up) and you can right-click and run it as admin.



     
  9. sarahnorthway

    sarahnorthway

    Joined:
    Jul 16, 2015
    Posts:
    78
    Does anyone know where the SDK Manager is in Unity's install of the android SDK? How do I "Please run the SDK Manager manually to make sure you have the latest set of tools..."?

    I'm running in to all these same errors, and yes running as an admin just changes the error, and yes you can get farther by telling it to use highest installed, but then after half an hour of packing shaders it fails with "Failed to install the following Android SDK packages as some licences have not been accepted."

    I do have another copy of the android SDK installed for a different engine which might be conflicting? And several versions of java. I thought it might have been an environment variable problem but I don't see anything pointing to my other copy of the SDK. Maybe it just isn't possible to have two copies of the Android SDK on one Windows 10 machine? I'd really prefer to keep the two environments separate.

    sdkmanager.bat gives me the error "Warning: File C:\Users\sarah\.android\repositories.cfg could not be loaded.". I tried creating a new repositories.cfg via "New-Item ~\.android\repositories.cfg -Force", and now sdkmanager.bat just does nothing.

    I feel like I'm into delete it all and install again territory.
     
    Last edited: Aug 19, 2022
  10. sarahnorthway

    sarahnorthway

    Joined:
    Jul 16, 2015
    Posts:
    78
    VeryVeryKnopp and terka-kerka like this.