So I couldn’t build my Android project with Target Api Level 29 because “Update Android SDK” failed (Unity 2019.4.3f1), but found a solution and thought I post it.
The original solution comes from here: android - Unity: Build failure, unable to update the SDK - Stack Overflow. Besides I don’t have Android Studio or any Java version installed, except what Unity installed (which is the Android module with OpenJDK).
Summarized steps: (adjust all paths to your case)
-
Create an empty “repositories.cfg” file in C:\Users\YourUserName.android\
-
Open the Command Line (CMD) and enter:
“C:\Program Files\Unity\Hub\Editor\2019.4.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\bin\sdkmanager.bat” “platforms;android-29”
If warnings appear that JAVA and JAVA_HOME aren’t found, you have to set the Environment Variables in your System:
Add this to the PATH variable:
C:\Program Files\Unity\Hub\Editor\2019.4.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin
Create new JAVA_HOME variable with this value:
C:\Program Files\Unity\Hub\Editor\2019.4.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK
When trying the command again and the download stops at 10%, you have to run it with admin rights. Rightclick the CMD before opening and “Run as Admin”, then try again.
Now it downloads successfully, Unity Project builds with Target Api Level 29, no complaints from Playstore anymore.