Installing New Android SDKs for Unity
As of the writing of this article, the currently most up-to-date LTS version of Unity (2021.3.17.f1) will only install Android SDKs 29 and 30 by default.
The Google Play Store requires a minimum version of 31.
Thus, the need to upgrade our SDKs!
We can view the target Android SDKs in Unity by opening Project Settings > Player > Other Settings > Identification.
Here we need to set our Minimum and Target API levels as desired.
I personally had issues building to version 33, so I set the Minimum to 31 and the Target to 32.
Doesn’t Unity Take Care of That?
Yes, it usually does.
Normally when you attempt to build to an API level that is not installed, the Unity editor will download and install it.
However, that functionality was not working when I needed to submit to the Google Play Store!
The easiest way to get up-to-date and readily usable files for the latest Android SDKs is using the Android Studio app.
You can download this for free here:
Once you open Android Studio, simply click More Actions > SDK Manager.
From here, you can install the desired SDKs.
Once you’ve installed the SDKs, open the file location shown at the top of the Settings screen.
We’re interested in the “platforms” and “platform-tools” folders.
But we’ll need to find where Unity stores its Android SDKs first.
Where Does Unity Keep Android SDKs?
In Unity, go to Preferences > External Tools > Android.
Click the “Copy Path” button next to “Android SDK Tools Installed with Unity”.
Open Windows File browser and paste in the address.
Copy and paste the “platform-tools” folder just in case we need to revert this back to its original state.
Close the Unity Editor or the files won’t be replaceable.
Overwrite the files in Unity’s Android SDK “platform-tools” folder with those from the Android Studio folder.
Now go back to the SDK folder for both Android Studio and Unity and open the “platforms” folder in each.
Copy the folders from the Android Studio folder over to the Unity folder.
As I had already done this, API levels 31 through 33 project folders are already there.
Build to Android with the targeted levels you’ve now installed!