Android tutorial - android sdk tools - android studio tutorial
What is API?
- an application programming interface (API) is a set of subroutine definitions, protocols, and tools for building application software. In general terms, it is a set of clearly defined methods of communication between various software components
what is SDK Level
- you can use Android APIs while also supporting older versions by adding conditions to your code that check for the system API level before executing APIs not supported by your minSdkVersion.
- 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
- 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”.
- 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
- Step 2: Here you have to change minimum and Maximum sdk level as per your requirement. check the below given code:
- Step 3: Click on Sync Now and You are ready to go.
- Note: If you are choosing the First Approach then you need not to make changes in Gradle. It will automatically update the gradle.