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. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Setting up android JDK and NDK for unity 2018.4.18f1 LTS

Discussion in 'Android' started by SprayNpraY, Feb 29, 2020.

  1. SprayNpraY

    SprayNpraY

    Joined:
    Oct 2, 2014
    Posts:
    156
    Hi I've seen there are a few tutorials including on youtube how to set up android for unity 2018 but I can;t find any that covers the speicific issues I'm having.

    When going to create a build Its saying it can't find the SDK. I Have android 10.0 (Q) downloaded from android studio and I've selected the file location and says unable to find SDK when I go to build or select the folder in external tools.

    I'm selecting the same location as stated in android studio for me which is

    C:\Users\Fierce\AppData\Local\Android\Sdk

    Im reading the the manual and its showing information for 2019
    https://docs.unity3d.com/2018.4/Documentation/Manual/android-sdksetup.html

    I don't have the option as you can for 2019 to also download the SDK and it says it doesn't support SDK versions that unity isn't providing so I have no idea how to fix this issue...
     
    Last edited: Mar 1, 2020
    pagan_poetry likes this.
  2. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    824
    Hi, this page might be more useful https://docs.unity3d.com/2018.3/Documentation/Manual/android-sdksetup.html
    You probably haven't installed build tools and platform tools. Note that SDK consists of 4 parts: "tools", "platform api", "platform tools" and "build tools". What is installed by default is just "tools" part. As you're saying that you have installed "android 10.0 (Q)", I suspect that is platform api for android 10 (which is "platforms;android–29"). Then you still need to install "platform tools" and "build tools" from the SDK manager in Android Studio. These tools are in a separate tab than the platform APIs. Notice the "SDK Tools" tab selected in this screenshot instead of the "SDK Platforms" tab: https://developer.android.com/studio/images/sdk-manager-tools_2x.png
     
    korchun_srsly and SprayNpraY like this.
  3. SprayNpraY

    SprayNpraY

    Joined:
    Oct 2, 2014
    Posts:
    156
    Thanks for the reply I'm finding it difficult to use the command prompt I have already tried as shown in the screen shot. I've recorded a short video showing and explaining what I've done so you can see if I'm missing anything as I think I've already tried exactly what you;ve suggested

    This is the link to the video:
    https://www.loom.com/share/062c5bd9f1e14b1bb802da5e6ac4c722
     
  4. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    824
    Thanks for providing a video. It seems that you have all the required components installed, however you have installed a release candidate of the build tools. Unity had issues detecting release candidate tools and that was fixed some time ago, but I am not sure if it was fixed in 2018.4. Based on your video, I would guess that the issue is still there in 2018.4 and you would be able to avoid it by uninstalling rc version and installing the latest non-rc version. In the Android Sdk Manager, there is a checkbox called "Show Package Details" in the bottom right corner. Click it, then install Android SDK Build-Tools version 29.0.3 and uninstall version 30.0.0-rc1. That should allow Unity to detect the SDK.
     
    Sherwinkc and SprayNpraY like this.
  5. SprayNpraY

    SprayNpraY

    Joined:
    Oct 2, 2014
    Posts:
    156
    Hi thanks for the instructions again, I've followed them but still having the same issue, I've recorded another video that displays what I've done so you can see if I've done anything incorrectly.

    https://www.loom.com/share/8da329c2e203463bb145814f77f2b713

    --
    Also on another note I'm not sure if this is the right thread to post this but I was having another android deployment issue with 2019.3 and is one of the reasons I went to 2018.4 to try and avoid issues. The SDK works for that version as it comes with unity but no one has replied to it could you or someone from the unity team check this post out please:

    https://forum.unity.com/threads/tem...assemblies-assembly-csharp-dll-failed.837916/

    Thanks
     
  6. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    824
    Hi again. Thanks for being persistent and for providing detailed description (in a form of a video). Finally I've been able to reproduce this on my machine and this is a worrying thing. The issue you've encountered will be reproducible with all Unity versions and will require a fix on our side. However there is a workaround you can use for now. The problem is that the new SDK manager, which is included in Android Studio 3.6 does not install "SDK Tools" as it considers them obsolete. However Unity checks for the presence of these tools to determine if SDK was installed. This is a recent change and as I've said will require fixes on our side, however that also means you can work around it by installing the SDK Tools yourself. In the SDK manager uncheck the "Hide Obsolete Packages" checkbox and install "Android SDK Tools (Obsolete)" component. This will allow Unity to detect the SDK for now.
    upload_2020-3-4_14-20-1.png
    Thank you once again for helping to detect this change in Android SDK.
     
  7. SprayNpraY

    SprayNpraY

    Joined:
    Oct 2, 2014
    Posts:
    156
    That fixed it thanks again
     
  8. Atheosls

    Atheosls

    Joined:
    May 19, 2017
    Posts:
    7
    fixed in 2018.4.17f1
     
  9. arfish

    arfish

    Joined:
    Jan 28, 2017
    Posts:
    777
    Think it´s still broken on Mac. Got the same error after update to Android Studio 3.6.3.

    Unity 2018.4.22f1 was working fine with the previous Android Studio, think it was 3.5 something.

    Now it throws this error message when trying to build using gradle.
    1_errmsg1.png

    Following message when "Use Highest Installed":
    2_errmsg2.png


    The error msg in the console log: 3_console_log.png

    This is the current installed SDK Tools in Android Studio (same Android SDK Location, as before, and the one Unity is using):
    4_studio_sdktools.png
     
    Last edited: May 6, 2020
    GFHTking1 likes this.
  10. arfish

    arfish

    Joined:
    Jan 28, 2017
    Posts:
    777
    Found this thread where the solution was to use Java 8 instead to run avdmanager.
    https://stackoverflow.com/questions...va-lang-noclassdeffounderror-javax-xml-bind-a

    That made ./avdmanager list target -c run without errors in Terminal.

    So, avdmanager runs fine in the Terminal with the environment variable:
    JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home
    but not with:
    JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-12.0.1.jdk/Contents/Home

    Unity 2018.4.22 did still throw the error for avdmanager so it must be using another version of Java. I guess something have happened when updating Android Studio to 3.6.3.

    Changed the jdk path from using embedded jdk, to use the latest jdk from Unity 2019:
    /Applications/Unity/Hub/Editor/2019.3.13f1/PlaybackEngines/AndroidPlayer/OpenJDK

    The SDK is also pointing to the one from 2019.3.13.

    Fingers crossed :)
     
  11. ahmedaniss

    ahmedaniss

    Joined:
    Sep 18, 2019
    Posts:
    98

    installed unity and setup jdk & sdk & ndk & gradle here :
     
    raz2606 likes this.
  12. Havie

    Havie

    Joined:
    Oct 12, 2019
    Posts:
    88
    Why is this still a problem? especially on an LTS (2020.3.19) I am having to do the same steps
     
  13. Z0rank

    Z0rank

    Joined:
    May 1, 2020
    Posts:
    3
    Having same issues with Unity 2021.3.10f1. Should I uninstal Android Studio before installing Unity?