adroid sdk in unity code example

Example 1: 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).

Example 2: change android sdk version unity

Edit > Project Settings > Player. Under Per-Platform Settings, click the Android tab, and then click on Other Settings to expand the section. Change the Minimum API Level to Android 2.2 'Froyo' (API level 8) or higher

Tags:

Misc Example