We are upgrading Android NDK, SDK and JDK used in Unity 2022.2. NDK will be upgraded to r23b. SDK will be upgraded to depend on cmdline-tools version 6.0 (instead of deprecated “tools” component) and Unity will require to have build-tools and platform-tools versions 32.0 or newer installed. JDK will be upgraded to version 11.
During the latest alpha and a couple of upcoming beta releases, Hub can install incorrect tools versions when installing Android support. Currently available Hub versions install the same dependencies as for Unity 2022.1. This is fine for SDK and JDK since current Unity 2022.2 versions still expect old SDK and JDK, but latest 2022.2 alpha versions already require NDK r23b.
In upcoming days, Hub version 3.2 should be released which will install NDK r23b, JDK 11 and updated SDK, however Unity will start accepting new SDK and JDK only during later beta releases.
We will update this post once dependencies provided by the Hub will match tools versions expected by the latest Unity 2022.2 beta release. Meanwhile please don’t depend on Hub to install SDK, NDK and JDK. Sorry for the inconvenience.
Doesn’t seem like this is really limited to Hub only. I think recent Hub 3.2 beta installs the SDKs mentioned here but 2022.2.0a17 just straight up refuses to accept them… And if you install a17 with android sdks on Hub 3.1 it just fails to build as well.
I figured this out. Basically for 2022.2.0 a16 and a17 you only ever need to update NDK and not update Android SDK or OpenJDK but if you use Hub 3.2 beta, it actually updates these all and that makes these incompatible with current 2022.2 alphas. Basically right now there’s no Hub version that works out of the box with latest 2022.2 alphas but if you need to build for Android, you should use Hub 3.1 or older and just swap NDK to newer version.
For NDK I just used the newer version provided by that Hub 3.2 (manually copied the folder from <2022.2.0a17 install dir>\Editor\Data\PlaybackEngines\AndroidPlayer) but I suppose you could just manually download it and use that one instead as well so you don’t have to deal with that Hub beta (which you shouldn’t since it breaks rest of the android packages now). Direct NDK r23b download links here (it’s not listed on their site anymore but DL works):
Win: https://dl.google.com/android/repository/android-ndk-r23b-windows.zip
Mac: https://dl.google.com/android/repository/android-ndk-r23b-darwin.dmg
That’s asking for trouble in the Android world, it’s already as bad as it is (although it used to be even worse). Built in Unity Hub SDKs may be a little dated but at least they are certified to work with Unity projects.
What I mean is, unityhub can have their own android studio, but it should be centralized in the hub and load android sdk/ndk into the same places. Then each unity can share the same android sdk/ndk repo (which could be many version)
And even using locally provided android manager, it could also be manipulated to download and store android sdk/ndk for specific version unity wanted to use.
Let’s think about this. If we have unity 2021.2 and want to update to 2021.3 or even 2022.1, it would more likely to use the same android sdk/ndk version. And so we might not need to download whole sdk again repeatedly and keep the duplicate sdk in difference folder on our disk
Unity project settings for android should also have version selector, and download button for any version, and reset button to revert back to factory setting sdk version. Also unity hub should have some ui for controlling android studio, such as remove all unused version from the disk or function to clean and download all sdk and ndk version that installed unity would wanted
This behaviour should be default behaviour of every module. But android studio might be good choice for implemented first as a test system
Hello.
Unity Hub 3.2
Unity 2022.2.0b8
installation from the hub does not work.
There are fixes in this version that should reduce the number of crashes.
I was able to install the NDK and JDK manually, but the SDK contains too many packages.
When is it planned to fix this?
In my opinion, there should be an option for Unity to just use ANDROID_HOME as well as an option allowing you to provide an explicit directory instead. (ANDROID_HOME is more flexible when dealing with CI builds on multiple platforms!)
The assumption should then be that the contents of this directory are as would be created by the Android SDK manager (command-line or via Android Studio – same thing), providing SDKs, build-tools, platform-tools, etc, under this directory.
Oh, and one should be able to explicitly spell out the build-tools version to use for a project – rather than Unity simply using the latest available as it currently does. This applies wherever/however the Android SDK tools directory is specified/located, internal or external.
Similarly for the NDK, if one chooses not to install and use a Unity bundled NDK, there should be an option to use the expected location under the external SDK directory if one has been specified (via ANDROID_HOME or explicitly as per above). There should be options to use ANDROID_NDK_HOME or an explicit directory instead as well.
And newer maintenance releases of the required NDK version should be explicitly supported.
I’ve noticed that with Unity Hub 3.3 and Unity Editor 2022.2.0b10, if you install the Android tools via the Unity Hub GUI, it installs perfectly fine and Unity picks it up correctly. However, when installing the Android tools via Unity Hub CLI, it still installs the old versions of the NDK and JDK which causes build errors. This was tested on Ubuntu 20.04. Is this a known issue or does it need to be bug reported somewhere to get it fixed? Thanks!
Installing via CLI with the command /opt/unityhub/unityhub-bin --no-sandbox --headless install-modules --version "2022.2.0b10" --module "android" --childModules
Great to hear you upgraded the SDK, NDK & JDK in 2022.2. I also wanted to give a heads up for anyone else looking for a updated Gradle version that 2022.2 is in fact using Gradle v7 which is great (I needed this for supporting a android .aar library plugin I wrote).
From release notes:
Android: Unity uses Android Gradle Plugin 7.1.2 by default.