Cant update platforms;android-31

Hi cant Cant update platforms;android-31. I get this Error
Exception: Unable to install additional SDK platform. Please run the SDK Manager manually to make sure you have the latest set of tools and the required platforms installed.
C:\Program Files\Unity\Hub\Editor\2020.3.16f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\bin\sdkmanager.bat “platforms;android-31”, exit code 1
Powershell non elevated output:

i have tried to manually install update but no luck this is what I get.

1 Like

You need to put quotes around “C:\Program Files\Unity\Hub\Editor\2020.3.16f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\bin\sdkmanager.bat”, since the path contains a space character.

thanks i used this tutorial it fixed it for me

3 Likes

So it seems the problem for some of us is having an incompatible JDK being utilized instead of the one packaged with Unity.

What worked for me was adding Unity’s embedded JDK path to my system PATH such that it gets used instead of my other JDK installation. I also could’ve temporarily supplied an augmented PATH and ran the AndroidSdkTool CLI manually, and that should work also.

Posting this here just to share the love, hopefully it saves someone else some time :slight_smile:

Worthy addendum, since I had to walk my coworker through some additional steps with this one:

After adding the embedded JDK to the system PATH variable, we had to completely shut down all Unity editors + Hub, restart Hub as Administrator, re-open the project, and build again to trigger the auto SDK updater.

For me it was setting the JAVA_HOME Variable to unity OpenJDK Location