Setting up android JDK and NDK for unity 2018.4.18f1 LTS

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

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…

1 Like

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

2 Likes

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

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.

2 Likes

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://discussions.unity.com/t/778788

Thanks

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.
5549776--571408--upload_2020-3-4_14-20-1.png
Thank you once again for helping to detect this change in Android SDK.

11 Likes

That fixed it thanks again

fixed in 2018.4.17f1

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.
5811061--615013--1_errmsg1.png

Following message when “Use Highest Installed”:
5811061--615010--2_errmsg2.png

The error msg in the console log:

This is the current installed SDK Tools in Android Studio (same Android SDK Location, as before, and the one Unity is using):

1 Like

Found this thread where the solution was to use Java 8 instead to run avdmanager.
https://stackoverflow.com/questions/46402772/failed-to-install-android-sdk-java-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 :slight_smile:

installed unity and setup jdk & sdk & ndk & gradle here :
https://www.youtube.com/watch?v=9N8a73tewxk

1 Like

Why is this still a problem? especially on an LTS (2020.3.19) I am having to do the same steps

Having same issues with Unity 2021.3.10f1. Should I uninstal Android Studio before installing Unity?