By James B

2013-10-19 10:31:57 8 Comments

I want to change the minimum SDK version in Android Studio from API 12 to API 14. I have tried changing it in the manifest file, i.e.,

    android:targetSdkVersion="18" />

and rebuilding the project, but I still get the Android Studio IDE throwing up some errors. I presume I have to set the min SDK in 'project properties' or something similar so the IDE recognizes the change, but I can't find where this is done in Android Studio.


@Wisam Atil 2020-02-07 18:31:37

File>Project Structure>Modules you can change it from there

@Sotti 2013-11-23 21:08:10

When you want to update your minSdkVersion in an existent project...

  1. Update build.gradle(Module: app) - Make sure is the one under Gradle Script and it is NOT build.gradle(Project: yourproject).

An example of build.gradle:

apply plugin: ''

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.2"

    defaultConfig {
        applicationId "com.stackoverflow.answer"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), ''

dependencies {
    androidTestCompile 'junit:junit:4.12'
    compile fileTree(dir: 'libs', include: ['*.jar'])
  1. Sync gradle button (refresh all gradle projects also works)

For beginners in Android Studio "Sync gradle button" is located in Tools -> Android -> Sync Project with Gradle Files "Rebuild project" Build -> Rebuild Project

  1. Rebuild project

After updating the build.gradle's minSdkVersion, you have to click on the button to sync gradle file ("Sync Project with Gradle files"). That will clear the marker.

Updating manifest.xml, for e.g. deleting any references to SDK levels in the manifest file, is NOT necessary anymore in Android Studio.

@mobibob 2013-12-27 18:00:49

My project's build.gradle is empty? What is the syntax to update? --- Ooops, there are two build.gradle files. I found the one in -> src has the versions, etc.

@mobibob 2013-12-28 02:26:49

Using this advice, I managed to get things to sync, but I had to EXIT Android Studio before the compile was error free. I performed many little steps, so I don't know what was really the necessary step.

@Dean Wild 2014-06-10 15:35:27

why have they made it such a ball ache? seem to remember in eclipse I only had to do this in one place...

@Sotti 2014-07-26 09:37:28

@DeanWild In Android Studio is as well in one place. Forget about API levels in the manifest file.

@android developer 2015-01-09 15:42:26

Is it possible to make it use the manifest instead? Also, is it possible to make it always use the latest build-tools that are available?

@inquisitive 2015-05-19 12:20:56

As of now, you can find two build.gradle inside Gradle Scripts folder, I needed to go for the one having Module:app.

@Sotti 2015-07-21 09:21:00

@androiddeveloper Gradle overrides the manifest, so just delete it from the gradle file and add it to your manifest file. I DO NOT recommend this tho, Gradle is the way to go and there are reasons why they went from manifest to gradle.

@android developer 2015-07-21 18:55:00

@Sotti Thank you. Didn't know this. What's the benefit of putting it on the gradle file?

@Sotti 2015-09-28 21:21:32

@Quantumdroid That is because you are using the Android view. I don't like that view and don't use it.

@CGR 2017-06-28 22:32:27

For beginners in Android Studio "Sync gradle button" is located in Tools -> Android -> Sync Project with Gradle Files "Rebuild project" Build -> Rebuild Project

@Salah Klein 2015-05-13 19:48:33

In android studio you can easily press:

  1. Ctrl + Shift + Alt + S.
  2. If you have a newer version of android studio, then press on app first. Then, continue with step three as follows.
  3. A window will open with a bunch of options
  4. Go to Flavors and that's actually all you need

You can also change the versionCode of your app there.

@Rido 2017-10-10 21:32:46

For the latest Android Studio v2.3.3 (October 11th, 2017) :
1. Click View on menu bar
2. Click Open Module Settings
3. Open Flavors tab
4. Choose Min Sdk version you need
IDE Project Structure Window 6. Click OK

@Hubert Hubert 2016-07-12 11:27:27

Gradle Scripts ->
build.gradle (Module: app) ->
minSdkVersion (Your min sdk version)

@Chris Deck 2016-07-01 15:10:20

Changing the minSdkVersion in the manifest is not necessary. If you change it in the gradle build file, as seen below, you accomplish what you need to do.

defaultConfig {
   applicationId "com.demo.myanswer"
   minSdkVersion 14
   targetSdkVersion 23
   versionCode 1
   versionName "1.0"

@Dharmendra Pratap 2016-05-20 07:35:22

In Android studio open build.gradle and edit the following section:

defaultConfig {
    applicationId "com.demo.myanswer"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"

here you can change minSdkVersion from 12 to 14

@Meier 2014-04-15 09:10:02

According to this answer, you just don't include minsdkversion in the manifest.xml, and the build system will use the values from the build.gradle file and put the information into the final apk.

Because the build system needs this information anyway, this makes sense. You should not need to define this values two times.

You just have to sync the project after changing the build.gradle file, but Android Studio 0.5.2 display a yellow status bar on top of the build.gradle editor window to help you

Also note there at least two build.gradle files: one master and one for the app/module. The one to change is in the app/module, it already includes a property minSdkVersion in a newly generated project.

@priyankvex 2014-12-23 19:20:55

As now Android Studio is stable, there is an easy way to do it.

  1. Right click on your project file
  2. Select "Open Module Settings"
  3. Go to the "Flavors" tab.

enter image description here

  1. Select the Min SDK Version from the drop down list

PS: Though this question was already answered but Android Studio has changed a little bit by its stable release. So an easy straight forward way will help any new answer seeker landing here.

@Al0x 2015-09-05 09:45:22

Editing the gradle files didn't work for me, but this did. Thanks!

@hamx0r 2015-11-12 23:31:28

This has changed again: The "Flavors" tab is no more. Instead, on step 3, in the Project Settings area click Modules then use the Project Level drop down box to select the API version. This isn't the same as setting the min API version, but rather the version which will be used to build the app.

@Vivekanand 2016-02-25 16:14:49

This must be the accepted answer. Least the newer version of Android Studio

@Reign.85 2016-03-07 14:50:19

I only get api 23 in the dropdown... I need api 10

@user30478 2018-08-31 07:40:46

little bit? this fking IDE changes a lot between versions causing a lot of breaks in running old code. Very very pathetic compared to the legacy of backward compatibility that is exemplified by Microsoft.

@Seichi 2018-09-13 16:24:52

Accepted answer and the second most "accepted" answer didn't work for me, lots of errors on build, this is the right solution for me! thanks

@Sabri MeviƟ 2014-07-05 13:57:29

In build.gradle change minSdkVersion 13 to minSdkVersion 8 Thats all you need to do. I solved my problem by only doing this.

defaultConfig {
    applicationId "com.example.sabrim.sbrtest"
    minSdkVersion 8
    targetSdkVersion 20
    versionCode 1
    versionName "1.0"

@Juan Reyes 2014-05-07 18:16:23

If you're having troubles specifying the SDK target to Google APIs instead of the base Platform SDK just change the compileSdkVersion 19 to compileSdkVersion "Google Inc.:Google APIs:19"

@user3291001 2014-02-10 00:29:09

For android studio users:

  1. right click the App directory
  2. choose the "module setting" option
  3. change the ADK Platform as what you need
  4. Click Apply

The gradle will rebuild the project automatically.

@GeertVc 2014-07-22 07:35:46

The above solution given is, to me, the best way to go. Let the tool do all the necessary changes iso you yourself fiddling with different files, taking the risk of screwing things or forgetting important details.

@Martin 2014-08-05 09:43:41

This doesn't work in Studio 0.8.2. You can change settings and press aplly, but studio ignore this.<br/> Solution: - Close Android Studio - Edit "/app/build.gradle" - change SDK-MinVersion entry - restart Android Studio Gradle syncs automatically

@Yannick 2015-10-25 13:09:37

In Studio 1.4 you need to look in the "Flavors" tab. See priyankvex's answer.

@Sum None 2019-09-08 17:26:48

In Studio 3.5, you need to click the "Default Config" tab. Flavors tab doesn't appear to exist any more.

@Chris Rolliston 2013-11-10 11:44:14

As well as updating the manifest, update the module's build.gradle file too (it's listed in the project pane just below the manifest - if there's no minSdkVersion key in it, you're looking at the wrong one, as there's a couple). A rebuild and things should be fine...

@Jamppa 2013-10-27 09:27:13

For me what worked was: (right click)project->android tools->clear lint markers. Although for some reason the Manifest reverted to the old (lower) minimum API level, but after I changed it back to the new (higher) API level there was no red error underline and the project now uses the new minimum API level.

Edit: Sorry, I see you were using Android Studio, not Eclipse. But I guess there is a similar 'clear lint markers' in Studio somewhere and it might solve the problem.

Related Questions

Sponsored Content

49 Answered Questions

[SOLVED] Rename package in Android Studio

  • 2013-05-29 01:24:49
  • ramzixp
  • 887224 View
  • 1358 Score
  • 49 Answer
  • Tags:   android-studio

50 Answered Questions

[SOLVED] Is there a unique Android device ID?

104 Answered Questions

[SOLVED] Close/hide android soft keyboard

51 Answered Questions

[SOLVED] How do I "select Android SDK" in Android Studio?

50 Answered Questions

[SOLVED] You need to use a Theme.AppCompat theme (or descendant) with this activity

22 Answered Questions

[SOLVED] What is Gradle in Android Studio?

11 Answered Questions

[SOLVED] Proper use cases for Android UserManager.isUserAGoat()?

21 Answered Questions

[SOLVED] Where to place the 'assets' folder in Android Studio?

Sponsored Content