Understanding minSdkVersion, targetSdkVersion and maxSdkVersion?


In android studio, we frequently hear minSdkVersion and targetSdkVersion and maxSdkVersion terminologies. Let's understand what it means?

minSdkVersion : An integer designating the minimum API Level required for the application to run. The Android system will prevent the user from installing the application if the system's API Level is lower than the value specified in this attribute.

targetSdkVersion : An integer designating the target API Level that application is going to target. If you didn't set the targetSdkVersion then minSdkVersion and targetSdkVersion will be the same.

maxSdkVersion : An integer designating the max API Level where application can run. If you didn't set the maxSdkVersion then targetSdkVersion and maxSdkVersion will be the same.

How to change api level in android studio?


There are 2 easy way to change api level in Android Studio.

Through Project Structure Window

Here are steps to change api level through Project Structur window

  • Step 1: Go to File ->Project Structure and click it.

    AndroidStudio Project Structure


  • Step 2: Select app module at bottom left side and Click on Flavors tab.
    AndroidStudio Project Structure Flavors tab
  • Step 3: Select desired Min Sdk Version and Target Sdk Version and click on Ok button to finish.

Through build.gradle

  • Open build.gradle(Module: app)
    AndroidStudio build.gradle
  • Make the desired changes in minSdkVersion and targetSdkVersion
    AndroidStudio build.gradle
  • Click on Sync link to finish the task.

Share & Like

Tutorial topics

About ApnaTutorials.com

ApnaTutorials.com is for Java, J2ee, Html5 and android developers. All tutorials are well explained and are easy to understand. We have tested every tutorials on our developement environment before posting it in public domain.