How To Change Minimum Sdk Version In Android Studio

When you use the android widget in layout XML or java code, you may encounter error messages like Call requires API level 23 (current min is 17):. This means your current android minimum SDK version is 1.7, which is too low to use this widget. You need to change it to 23. This article will show you how to change it in android studio.

First, we should know the below two terms about the android SDK version.

  1. minSdkVersion: This is the minimum version of android os that your app support.
  2. targetSdkVersion: This is the android os version which your app actually executed with.
  3. Your app should compatible with all the android os versions between minSdkVersion and targetSdkVersion.

1. Change Android SDK Version In Android Studio.

There are two methods that can change the android SDK version in android studio.

1.1 Change in android studio project build.gradle File.

  1. Select Project in android studio Project view.
  2. Edit <project-name>/app/build.gradle file.
  3. Change minSdkVersion and targetSdkVersion in the right panel. You can search for it if you can not find it immediately.

1.2 Change in android studio project structure dialog.

  1. Click the android studio menu ” File —> Project Structure “.
  2. In the Project Structure dialog, select the app in the Modules list on the left side. Select the Flavors tab on the right panel, click the defaultConfig item in the dialog center, then you can select your desired android Min Sdk Version and Target Sdk Version from the related dropdown list.
    android-project-structure-dialog
  3. Click the OK button to save the selection.
  4. Click the ” Build —> Rebuild Project ” menu item to rebuild the android project.
  5. This time the build.gradle file will be changed by android studio automatically.
0 0 vote
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

5 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Micheal
Micheal

I am new to android coding, and recently I just create a new android project in android studio, and I want to change the project minimum SDK and target SDK version, and this article just tell me how to do it, thanks a lot.

Betty
Betty

This error occurred when I go to the google play store console to upload my android app. The google play store console said my android app API level must be 27 or higher, and my app API level is just 21.

Carrie
Carrie

My android studio displays a red line under my layout xml code and prompt a minimum API level 19 is required error, My current android studio minimum SDK version is 12 and I want to change it to version 19 in the android project manifest file like below. But after I change it in the android project and rebuild the project, the error still exist.

<uses-sdk
   android:minSdkVersion=”19″
   android:targetSdkVersion=”19″ />

Finally I find this article and follow the steps in this article and fixed this issue. I am very happy, too many thanks to the article author.

Adam
Adam

I’ve been working on this issue for two days. THANK YOU! Everywhere showed solution 1.1 and it just wasn’t working for me. Although my screen looks a lot different on Mac, I was able to follow 1.2 and resolve.

zameer
zameer
Reply to  Adam

thank you so much dude. your page helped me a lot.?

5
0
Would love your thoughts, please comment.x
()
x