Search Issue Tracker

Fixed

Fixed in 2021.3.36f1

Votes

0

Found in

2021.3.34f1

Issue ID

UUM-62275

Regression

No

[Android] The Android Player SDK path is not found when using the CMD Line Tools 2.1

--

-

Reproduction steps:
1. Create or open a project
2. Inside the Editor, build and run the Player (File > Build And Run)

 

Note: If you're using Unity built from source, tweak Android SDK in Preferences->External Tools, it should point to path with a whitespace, for ex.,
{code:java}
C:\Program Files\Unity3D\2021.3.34f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK {code}
Expected result: No error is thrown and builds succeed
Actual result: Builds fail with "Could not find or load main class Files\Unity\Hub\Editor\2021.3.34f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\cmdline-tools\2.1\bin.." error

Reproducible with: 2021.3.34f1

Reproducible on: Windows 10 (user's), Windows 11 (user's)
Not reproducible on: No other environment tested

Notes:
- The issue was not reproduced locally
- The issue can also impact target API levels, preventing APIs higher than 30 from being displayed
- “Failed getting available Android API levels. Make sure your android sdk tools version is 25 or higher and you have internet connection." error can also be seen inside the Editor.log file

Known workarounds:
- Switch to a lower version of the 2021.3 LTS
- Upgrade to the 2022.3 LTS
- Install the Editor version under the "C:\Unity\Editor" location
- Alter the "Editor\Data\PlaybackEngines\AndroidPlayer\SDK\cmdline-tools\2.1\bin\sdkmanager.bat" file:
set DEFAULT_JVM_OPTS={*}-Dcom.android.sdklib.toolsdir=%~dp0\..{*}
line to
set DEFAULT_JVM_OPTS={*}"-Dcom.android.sdklib.toolsdir=%~dp0\.."{*}

  1. Resolution Note (fix version 2021.3.36f1):

    This fix introduces a warning with information on how to work around this issue

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.