How to detect if desired Target API is installed for Android?

Hi, I tried searching this question but google gave me only issues related posts.

1) If I understood correct if the Target API was missing then Unity should prompt me to install it ? Also this post gives solution in case it does not let the install to go through (need to run Unity Hub as admin).

But I am confused since the Unity Editor shows one type of formatting up to Android 11.0 and then from Android 12.0 it is different, does it mean I am missing all of those 31 32 33 ? And would updating to 33 also overlay and work for 32 31 ?

…
Android 10.0 (API level 29)
Android 11.0 (API level 30)
and then
API level 31
API level 32
API level 33 ?

2) I just updated to Unity 2020.3.47 and release notes stated that support for SDK 33 is now available? Can someone please give more thoughts on that? First time trying to piece together all this Target API stuff

from release notes:
Package: - Android SDK Level 33 (Tiramisu) support now available.

  • Added necessary post notification permission to manifest.

  • Package will now ask for permission during initialization if required.

  • External Dependency Manager for Unity (EDM4U) and Mobile Dependency Resolver (MDR) support now available. When either is installed:

If you install android sdk, ndk, jdk via Unity Hub, you should get SDK 33 when installing latest Unity.

1 Like

If you want to know if the Target API set in the Player Settings is being used or not, you have multiple options to check it.
Quick option is to go to your Android sdk (packed with your unity version - You can find it from preferences → External Tools → Android SDK) folder.

Over there check for Platforms folder where you can see all the api versions installed. If you set in player settings target api as automatic highest installed, it picks the highest from this folder and use it. Else what ever you set from the dropdown.

If the target api set in Player settings doesn’t exist, it prompts to upgrade!

1 Like

So I thought, but when tried building with SDK 33 still got prompted with update message ?
with Install I selected Add modules - Platforms - Android Build Support + OpenJDK and Android SDK and NDK

Thank you. Would installing highest 33, would also work for any lower versions if I don’t have them ?

Setting Target API 33 means → Your app/game is tested “until” API 33 devices.

I made some pseudo code to understand this. Ignore if you find it confusing :smile:

bool DoesItWorkWellOnTheCurrentDevice()
{
    int currentUserOS = UserDeviceOS();
    if(curentUserOS < minmumApiLevel)
       return false;
    else if(curentUserOS >= minmumApiLevel && currentUserOs <= targetApiLevel)
       return true;
    else //if (currentUserOs > targetApiLevel)
    {
       Debug.LogWarning("May not be completely compatible as it didn't target this device api level/os.");
       return true;
    }
  
}

So once you build your apk/aab with Target API 33, it means
It may/may not work > API 33 devices, but, it works on devices which fall under <= API 33 and >= Your Min API Level

1 Like

Thank you so when I tried building for 32 I got prompted again to install that version ? So because no longer I used the 33 which was installed it required 32 now as the highest

N

Not sure if I got you right but,
If you explicitly set the target api and if that sdk version doesn’t exist, it will prompt to install when making a build.
If you set automatic, which ever is available as highest will be considered.

1 Like

Can someone tell me, if is there any point in always setting the latest API Level?
Or any recommendations?