DEV Community

Cover image for Android: Version types
Hodeem
Hodeem

Posted on • Edited on

Android: Version types

Android studio screenshot

In Android, you'll encounter various version numbers and terms that can seem confusing at first. This post aims to clarify the different types of versions in the Android ecosystem, helping you understand their purposes and relationships.

The version types I want to address are:

  • OS version
  • API level
  • minSdkVersion
  • compileSdkVersion
  • targetSdkVersion

OS Version

The Android OS version refers to the release version of the Android operating system. These versions are typically named after desserts and are associated with a version number. For example, Android 8.0 had the nickname Oreo, the tastiest snack in the western hemisphere. As of writing, the latest stable release is Android 14, with Android 15 in development.

API Level

The API level is an integer value that uniquely identifies the version of the Android framework API offered by a version of the Android OS.
Each Android OS version is associated with one or more API levels.
For example, Android 8.0 corresponds to API level 26 - 27.
This is one reason why the API level is used in minSdkVersion, compileSdkVersion, targetSdkVersion and other settings instead of the OS version.

minSdkVersion

The minSdkVersion is a value set in your app's build configuration that specifies the minimum API level required to run your application. It ensures that your app isn't installed on devices running an older, unsupported Android version. For example, if you set minSdkVersion to 26, your app will only be available to devices running Android 8.0 (Oreo) or higher.

It's recommended to choose the lowest API level that your app can support while still providing a good user experience. Consider factors like the features you need and the percentage of devices running each Android version. Setting it too high will limit your app's reach, while setting it too low might prevent you from using newer features.

compileSdkVersion

The compileSdkVersion is the version of Android that your app is compiled against. For example, if you set compileSdkVersion to 26, you can use APIs up to, and including, those in Android 8.0 in your code.

It's generally recommended to always compile with the latest stable SDK version to ensure you have access to the newest APIs.

targetSdkVersion

The targetSdkVersion indicates the highest API level on which you've tested your application. It tells the system that you've tested your app on this version, allowing the system to enable compatibility behaviours for higher API levels.

It's recommended to keep your targetSdkVersion as high as possible to ensure your app can take advantage of the latest Android features and optimizations.

Also, Google has a target API level requirement which indicates the minimum acceptable targetSdkVersion for apps that can be submitted to the Play Store.

Conclusion

Writing this post made me hungry, but it was worth it. I hope these versions are much easier to understand now.

Sources

Android version history
Target API level requirements for Google Play apps
uses-sdk-element

Top comments (0)