Search Unity

Android SDK location reset after restart

Discussion in 'Android' started by jerryhamk, Jan 20, 2020.

  1. jerryhamk

    jerryhamk

    Joined:
    Jun 4, 2019
    Posts:
    5
    I have to set Android SDK location in Preferences every single time after restarting my computer. I have the following setup:
    • Unity 2019.2.12f1 installed under C:\Program Files\Unity
      • Android and iOS support installed
      • No Unity Hub installed
    • Android SDK installed under D:\Android
    • Android NDK installed under D:\Android\android-ndk-r16b
    Here are my environment variables:
    env_variables.png
    and PATH:
    PATH.png

    When I start up Unity and open Preferences, the Android SDK is set to c:\android-sdk-windows and Android NDK is set to C:/android-sdk-windows/android-ndk-r16b. When I hit "Browse" for the SDK, a pop up notifies that "Unity has detected Android SDK at 'D:\Android'. Do you want to use this SDK directory?". The NDK is not automatically detected, and I have to manually browse the location. The locations I set are saved even if I close Unity Editor, but when I reboot the computer the settings are reset.
     
  2. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    836
    The preferences are stored in the registry key. Maybe your computer restores registry from backups after the restart or does something similar to that? Maybe antivirus software or antimalware software does this.
     
    jerryhamk likes this.
  3. jerryhamk

    jerryhamk

    Joined:
    Jun 4, 2019
    Posts:
    5
    The registry keys are under HKCU\Software\Unity Technologies\Unity Editor 5.x, correct? The SDK path seems to be stored in AndroidSdkRoot_* and NDK is path is stored under AndroidNdkRoot*.
     
  4. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    836
    yes, that should be correct.
     
  5. PortalFeather

    PortalFeather

    Joined:
    Aug 4, 2017
    Posts:
    1
    Were you able to fix this? Im having the same problem right now but in my case even if set the correct path for sdk, it still says system has sdk of api level 0 and its bugging me so much.
     
  6. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    836