How to change API level in Android studio

Asked 1 years ago, Updated 1 years ago, 93 views

I'd like to change the minimum SDK version from API12 to API14 in Android Studio. I changed it in the manifest file as shown below

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="18" />

Even if I change it and rebuild the project, there will be an error in the Android studio. I think we should set the minimum SDK version in the project properties or something like that, but I'm not sure where it is in the Android studio.

api android-studio android sdk ide

2022-09-22 16:46

1 Answers

To set the minimum SDK version, go to src/build.gradle and

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

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

dependencies {
    androidTestCompile 'junit:junit:4.12'
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

You have to do it like this.

Then press Sync Gradle button and rebuild the project.


2022-09-22 16:46

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.