how to download android sdk from unity editor code example

Example: manually update sdk unity

//Step 1: Go to your .android folder (Default is at C:\Users\*Your-Name*\.android).
//If there's a CFG file calles repositories there, great. If not, open notepad, create
//an empty cfg file called repositories.
//Step 2: Go to your SDK-tools-bin folder 
//(Default - C:\Program Files\Unity\Hub\Editor\*your-unity-version-here*\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\bin)
//Step 3: Open command prompt as admin.
//Step 4: Run the sdkmanager.bat file that's in the folder of step 2 using cmd as so:
//sdkmanager "platform-tools" "platforms;android-*desired API level*"
//Step 5: Command Prompt will show you the Terms and Conditions of the software. type y at the end to confirm.
//This should work. Note that * marks stuff you should change.

//Problems I've had:
//1. If after typing y there's an error, you've probably ran CMD not as an admin.
//2. If there's still an error in unity, make sure the "Target API Level" in unity hasn't changed (mine did).

Tags:

Misc Example