Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Android SDK Manager from within Unity (?)

Discussion in 'Android' started by quietline, Oct 21, 2019.

  1. quietline

    quietline

    Joined:
    Oct 22, 2018
    Posts:
    2
    On macOS Unity 2019.2, I’m trying to figure out how to install additional SDKs for other Android versions. In Android Studio, it is easy. Just go to SDK Manager and install any needed SDKs for whatever version I’m targeting. With Unity now bundling the Android SDK and NDK now in v2019, I’m not sure where we’re able to launch SDK Manager to add any new SDKs.

    I did find Android’s SDK Manager in /Applications/Unity/Hub/Editor/2019.2.8f1/PlaybackEngines/AndroidPlayer/SDK/tools/bin. However, when trying to launch it, it asks to download an Oracle JDK/JDM to run it.

    Is there a way to launch the SDK Manager from within Unity directly?

    The reason I’m trying to do this is because I’ve set my Minimum API Level to Android 7.0 in Build Settings and I’m unable to get the APK to install on my device. I suspect the new built-in SDK/NDK does not come with this API level.
     
  2. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    836
    There is no way to do that from the Unity editor. However you could use the SDK Manger from Android Studio by set the SDK path to "/Applications/Unity/Hub/Editor/2019.2.8f1/PlaybackEngines/AndroidPlayer/SDK/" in that manager.

    If the reason for the failure would be the missing API level, then you would not be able to build your application and you would get an error while building. If you are not able to install the application on the device, then there probably is a different reason. What error do you get when the installation fails?
     
  3. quietline

    quietline

    Joined:
    Oct 22, 2018
    Posts:
    2
    Thank you. This is great info on how to use AS to access Unity's install of the sdk. I had never thought about doing it that way.

    And, you are correct about the problem with not installing on the device as not being an API issue. I had an old version of the app on the device that needed to be removed before building the new one would install on the device properly.

    Thank you again!
     
  4. kavanavak

    kavanavak

    Joined:
    Sep 30, 2015
    Posts:
    54
    For anyone that finds this and is having problems with a Unity install not having an Android SDK when trying to build (I'm on 2020) here's a potential fix I wish I would have found sooner:

    windows:
    1. run CMD (command prompt) as an administrator: *Right-Click "run as administrator"*
    2. navigate to the Android SDK Manager installed by Unity:

    cd C:\Program Files\Unity\Hub\Editor\[UNITYVERSION]\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\bin

    3. I don't know if you need to run the SDK here first or not, I did:

    sdkmanager.bat

    4. Run this code, adding the API version you want to install:

    sdkmanager "platform-tools" "platforms;android-30"

    5. Agree to terms: Y

    Your missing SDK will now be installed, close and restart Unity if you had it open. You should now be able to do your build.

    Hope that helps.
     
  5. Aionix

    Aionix

    Joined:
    Aug 31, 2018
    Posts:
    5
    Thank you so much!
     
  6. Dawdlebird

    Dawdlebird

    Joined:
    Apr 22, 2013
    Posts:
    88
    Tried that, got:
    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.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
    at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
    Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 5 more

    And have no idea what that means :|
     
    JVimes likes this.
  7. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    836
    You have a newer java version installed on your machine than java8. Take a look at this answer for potential solutions. https://stackoverflow.com/questions...founderror-javax-xml-bind-a/51644855#51644855
     
    JelyMe likes this.
  8. unity3dgamedevx

    unity3dgamedevx

    Joined:
    Jul 26, 2021
    Posts:
    3
    In fact, the brief and summary of your question is described here https://www.gameplaydeveloper.com/unity-android-sdk/ So you may need to download the SDK plugins from scratch via the Unity Hub. I was also able to solve the problem by following this method.
     
  9. samisonkr

    samisonkr

    Joined:
    Apr 4, 2020
    Posts:
    1
    It works for me. Thanks dude.
     
  10. kanika03

    kanika03

    Joined:
    Jun 15, 2021
    Posts:
    1

    You saved a lot of time
     
  11. ViktorCor

    ViktorCor

    Joined:
    Jul 22, 2012
    Posts:
    13
    Hi

    I had a similar problem, searched all the forums, nothing helped.

    In the end, I solved it by installing JDK 8, setting JAVA_HOME in Environment Variables, and the path to install JDK.
    And also downloaded the latest Unity Hub 3.0.1 and installed Unity from it.

    After that, everything worked.

    Not sure what helped exactly, the latest Unity Hub or adding JAVA to Environment Variables...
     
  12. BATYR3

    BATYR3

    Joined:
    Feb 22, 2024
    Posts:
    2
    H
    i help me. I downloaded unity and installed it and wanted to download its internal stuff but it gives me an error
     
  13. BATYR3

    BATYR3

    Joined:
    Feb 22, 2024
    Posts:
    2
    По какой-то причине я не могу загрузить инструменты командной строки Android SDK. Я получаю сообщение об ошибке