Let's talk about:
- The difference between minSdkVersion and targetSdkVersion
- What minSdkVersion and targetSdkVersion should we use?
Both are values you pick and mention in your AndroidManifest.xml.
The minSdkVersion tells what sdk the OS should at least support, for the app to be able to install.
Example: If the minSdkVersion for your app is 34 (Android 14), but the OS is 23 (Android 6), the app will not be installed.
The targetSdkVersion tells what SDK you target, as in, the highest Android version you explicitly support.
Older phones will be able to install an app with a higher targetSdkVersion.
Example: if the targetSdkVersion for your app is 34 (Android 14), but the OS is 23 (Android 6), the app can be installed.
(Assuming the minSdkVersion is 23 or lower)
Newer phone will be able to install an app with a lower targetSdkVersion too.
Example: if the targetSdkVersion for your app is 34 (Android 14), but the OS is 35 (Android 15), the app can be installed.
Basically: The OS will not prevent your app from being installed because of the targetSdkVersion.
It will prevent an app to be installed because of a higher minSdkVersion.
For the minSdkVersion, there's no official recommendation. (Afaik)
But there's an unofficial recommendation, which is 23 (Android 6).
See: https://x.com/minSdkVersion
You can decide to use a higher minSdkVersion, if your app needs a specific feature, only available in higher SDK versions.
But this will mean some older devices will not be able to install your app (based on the OS level)
For the targetSdkVersion, there's an official recommendation;
And if you want to publish your app to the Google Play Store, it's even a requirement.
The recommended targetSdkVersion is 35+ (Android 15+) for Smartphone and Tablet targets.
It's 34+ (Android 14+) for Wear OS, Android Automotive and TV targets.
See: https://developer.android.com/google/play/requirements/target-sdk
| Phone | your minSdkVersion | your targetSdkVersion | Will install? |
|---|---|---|---|
| 23 (Android 6) | 23 | 35 | Yes |
| 23 (Android 6) | 34 | 35 | No |
| 34 (Android 14) | 23 | 35 | Yes |
| 34 (Android 14) | 34 | 35 | Yes |
| 35 (Android 15) | 23 | 35 | Yes |
| 35 (Android 15) | 34 | 35 | Yes |
| 35 (Android 15) | 23 | 34 | Yes |
Hope this helps!