How To Change API SDK Level In Android Studio

Basically, API level means the Android version. This defines for which version you are targeting your application and what is going to be the minimum level of android version in your application will run. For setting Minimum level and Maximum level android studio provides two terminologies.

minSdkVersion means minimum Android OS version that will support your app and targetSdkVersion means the version for which you are actually developing your application. Your app will be compatible with all the version of android which are falling between minimum level SDK and target SDK.


How to change API SDK level in Android Studio

For changing the API level in android we have two different Approaches, let’s check both one by one:

Approach 1 To Change SDK API Level in Android Studio:

Step 1: Open your Android Studio, and go to Menu. File >Project Structure.

project structure in Android Studio

Step 2: In project Structure window, select app module in the list given on left side.

Step 3: Select the Flavors tab and under this you will have an option for setting “Min Sdk Version” and for setting “Target Sdk Version”.

change api sdk level in Android Studio

You can check the name of version too in the drop down list while selecting the API level that makes the selection more clearer for anyone. Because sometimes remembering numbers is bit messy.

Step 4: Select both the versions and Click OK.


Approach 2 To Change API (Android Version) in Android Studio:

That will be pretty straight forward, but you need to stay very alert while making changes here.

Step 1: if you are project is opened in android option then select open Gradle Scripts > build.gradle(Module: app)

if you are in project View then click on your project folder > app > build.gradle

change sdk api level in build gradle android studio

Step 2: Here you have to change minimum and Maximum sdk level as per your requirement. check the below given code:

defaultConfig {
    applicationId "com.AbhiAndroid.Android.myProject"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}

Step 3: Click on Sync Now and You are ready to go.

sync now change api sdk android studio

Note: If you are choosing the First Approach then you need not to make changes in Gradle. It will automatically update the gradle.

  • Is this article helps you understand ?
  • Yes   No

One thought on “How To Change API SDK Level In Android Studio”