Android SDK 29 “unable to install additional SDK platform” issue & workaround

Issue:
When you select API Level 29 in Android Player Setting, Unity tries but fails to update the Android SDK:


The Android SDK that is currently installed with Unity Hub does not include support for API level 29. We are going to update the Hub install but we don’t not have yet determined when.

To update the Android SDK, Unity uses the Android sdkmanager command line tools, but the command will fail if it’s located in the filesystem in a path that has spaces (the default path used by the Hub on Windows e.g. “C:\Program Files\Unity\Hub\Editor\2020.1.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK”).

If you try to update the SDK with Android Studio SDK Manager UI tool with the SDK in such location, you will see a warning like this:

And the update will fail as well.

Workaround:
First we recommend you read the documentation about “Customizing the Android SDK & NDK Tools and OpenJDK installation” on this page Unity - Manual: Android environment setup, so you understand how & where Unity install the Android dependencies.

The simplest way to workaround this issue is to copy or move the Android SDK installed by the Hub to a different path that does not have spaces. After that you change the Android SDK path in the Unity Editor (Edit->Preferences->External Tools) and then let Unity update the SDK.

See screenshot below for example:

Future:
We are working on both updating Unity Hub installation process to include the latest Android SDK and fix the in Editor SDK update process. We will update this thread when these fixes are landing.

Until then please use the workaround above.

Sorry for the inconvenience!

9 Likes

On Windows, to update the Android version manually on your Unity, you can:

  1. Run CMD/Powershell as Administrator
  2. Run this command: C:/{UNITY_EDITOR_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/tools/bin/sdkmanager.bat "platforms;android-29"

Another way that probably works (and I have yet to test it) is installing the Unity Editor on a path different than “Program Files”, something like C:\Unity. That way Unity won’t need to have Administrator permissions to update files and hopefully, Unity will properly handle and accept the terms that shows up when you try to update Android SDK.

10 Likes

What I and a few others have done is copy the android 29 sdk directly into the folder that unity looks in for sdks.

1) Make sure you have the android 29 SDK:
Open Android Studio. After the splash screen has loaded, select the Configure button (bottom right, next to gear icon) and from the dropdown select SDK Manager and in the list make sure Android 10 (API 29) is checked, if it isn’t check it and apply to download the SDK.

2) Get the path to the Android SDK directory
From the same window, note the path in the text field labeled Android SDK Location

3) Get the path to Unity’s Android SDK directory
In Unity, click Edit => Preferences => External Tools. Scroll down and find a list of text fields with paths under the Android label. Note the path location in the field labeled Android SDK Tools Installed with Unity (recommended)

4) Copy the Android Studio SDK to Unity
Navigate to both paths in explorer. In each there will be a folder called ‘platforms’. Go into this folder from the Android SDK path and copy the android-29 folder to the platforms folder in the Unity path.

Credit goes to this dude and the stack overflow post he credits that I can no longer find:

https://www.youtube.com/watch?v=O3AHZVEDAQY

22 Likes

Update:
With the Hub 2.4.2, the Android SDK installed with Unity Editor 2019.4LTS is now at API level 29.
The in-Editor update process for Android SDK still fails on Windows if the Editor is installed in the default “/Program Files/” folder, we are still working on fixing this.
The workaround described in the initial post is still valid, you can also change the Unity Editor install folder (attached screenshot), by selecting a path with no space in the name and where the current logged in user have full read/write permissions.

1 Like

With the Hub 2.4.2, the Android SDK installed with Unity Editor 2019.4LTS is now at API level 29.

This was quite a surprise to me. And it’s pretty cumbersome to add another API level to the SDK, since you have to tweak Android Studio’s SDK folder to do this. I think it would be better if Unity included at least a couple of most common used and supported SDKs instead of breaking existing build processes. Or, there should be an easier way to add or remove SDKs. If there is, I’d be happy to learn about it.

2 Likes

Hi,
Unity Hub installs the latest version of the Android SDK Target API required by Google Play. We’re trying to stay in sync as much as possible. But if you need to use a more recent version, you can change the Target API in Player Settings, then Unity will ask if you want to update the Android SDK API.
(Note: We just fixed the issue where the SDK Update fails, and it will land in Unity 2020.2, 2020.1, 2019.4 in one of the next patch release, exact one still TBD)

If you select an older version of the Target API, the Unity Android SDK Updater will not be able to perform the update and will give you this message:

In this case, the easiest way to update the Android SDK Target API is to use the Android sdkmanager in Android Studio
In Android Studio SDK Manager tool, make sure you are selecting the right Android SDK folder used by Unity (found specified in Edit > Preferences > External Tools).

On Windows, if Unity Editor is installed in the default folder (/Program Files/), you will need to run the Android Studio with elevated privilege (Run as Administrator) to perform the update.

Hope this helps!
JC

1 Like

Another alternative workflow we suggest for our plugin users is as below.
Summary
Just copy to unity android sdk from Android Studio sdk folders!

Steps

  1. Have the default android sdk installed path (For ex: installed through Android Studio). I call this DEFAULT_ANDROID_SDK
  2. Have the path of unity’s android sdk path. I call this UNITY_ANDROID_SDK
  3. Go to DEFAULT_ANDROID_SDK
  4. Copy build-tools/29.x (or 30.x) and platforms/android-29 (or android-30)
  5. Paste it in corresponding folders in UNITY_ANDROID_SDK

This way you don’t need to change any paths in Unity. Hope it’s helpful.

1 Like

I solved this by running Unity as an administrator.

7 Likes

How To Use Update in Windows.

  1. Save this code to sdk.cmd.
  2. Modify UNITY_VERSION
  3. Add or change the SDK you need: platforms;android-XX
  4. Run sdk.cmd as Administrator.
set UNITY_VERSION=2020.1.8f1

c:
set JAVA_HOME=c:\Program Files\Unity\Hub\Editor\%UNITY_VERSION%\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\
set ANDROID_HOME=c:\Program Files\Unity\Hub\Editor\%UNITY_VERSION%\Editor\Data\PlaybackEngines\AndroidPlayer\
cd %ANDROID_HOME%SDK\tools\bin\
echo.> %USERPROFILE%\.android\repositories.cfg

cmd /C sdkmanager --update
cmd /C sdkmanager "platform-tools" "platforms;android-29"
cmd /C sdkmanager "platform-tools" "platforms;android-30"
cmd /C sdkmanager "platform-tools" "platforms;android-31"
45 Likes

thx @skdev3 this worked for me

2 Likes

Thanks for this tip.

Running Unity Hub as Administrator allowed Unity to update to Android SDK 30 when prompted when performing a build – didn’t need to do any command-line stuff, nor copy any folders anywhere, and no Android Studio either.

9 Likes

Saved my life, thanks a lot ~

1 Like

unity extensions are not yet initialized so we cannot say if the c program compatible with platform android hatası veriyor anlayamadım

THANK. YOU. BLESS!

Awesome man, thanks for posting, worked perfectly.

this is awesome. error fix in just a few second

Thank you so much! This video was exactly what i needed for updating mine to API level 31

Thank you for the video. It really works. Saved me lot of time.

it seems that unity hub 3.0 has build tools and sdk vs 30 support.
but it doesnt seem to work.
what can we do?

hi , it seemed as it installed , and also the platform tools do exist in the correct folder.
so your script worked for me.
but i did another installation and it still makes the same error.

even when i open a new empty project, here is what i get after trying to build:
"
The specified Android SDK Build Tools version (28.0.3) is ignored, as it is below the minimum supported version (29.0.2) for Android Gradle Plugin 4.0.1.

Checking the license for package Android SDK Build-Tools 29.0.2 in C:\Program Files\Unity\Hub\Editor\2020.3.20f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\licenses
License for package Android SDK Build-Tools 29.0.2 accepted
"