Tag Archives: android-api-levels

Change API level Android studio

Changing API Level Android Studio
I want to change the minimum SDK version in Android Studio from API 12 to API14. I have tried changing it in the manifest file, ie, I want to change the minimum SDK version in Android Studio from API 12 to API14. I tried to make the change in the manifest file, which is

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

and rebuilding the project, but I still get the Android Studio IDE throwing up some errors. and rebuild projects, but I still get the Android Studio IDE throw out some mistakes. 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. I think I have to set the min SDK in project properties or something similar so that the IDE can recognize changes, but I can’t find anything done in Android Studio.


# 1/f,
Reference: https://stackoom.com/question/1JfkP/ change the Android API level – Studio


# 2 floor
For me what worked was: (right click)project-> android tools-> Clear lint markers. , for me, markers that have worked are :(right click) markers -> The android tools – & gt; Remove lint marks. 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. although for some reason the list has been restored to the old (lower) minimum API level, But after I changed it back to the new (higher) API level, there was no red error underscore, and the project now USES the new lowest API level.
Edit: Sorry, I see you were using Android Studio, not Eclipse. Edit: Sorry, I see you are using Android Studio, not Eclipse. But I guess there is a similar ‘clear lint markers’ in Studio somewhere , which I think might be able to solve the problem.


The # 3 floor
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, Gradle build. Gradle file for the module (list this file in the project pane at the bottom of the list – if there is no minSdkVersion key in it, then you have entered the wrong key because there are several). A rebuild and things should be fine… rebuild, everything should be fine…


# 4 floor
When you want to update your minSdkVersion in an existent project… when you want to update your minSdkVersion in an existing project…

    Update build. Gradle (Module: app)-make sure is the one under gradle 4 build and it is NOT build. Gradle (Project: yourproject) Update build. Gradle (Module: app) App) - make sure it's the one under Gradle Script, not build. Gradle (Project: yourproject).

An example of build.gradle: build.gradle :

apply plugin: 'com.android.application'

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'), 'proguard-rules.pro'
    }
}

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

For beginners in Android Studio "Sync gradle button" is located in Tools -> Android -> Sync Project with Gradle Files "Rebuild project" Build -> Rebuild Project for beginners in Android Studio, the "sync gradle button" is located in the tool -> Android-> Use Gradle file to synchronize the project "Rebuild Project" build-& gt; Rebuild Project

    Rebuild project 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"). update build. After gradle minSdkVersion, you must click on the button gradle sync file (' sync Project with cradle files'). That will clear the marker. this will clear the marker.
Updating manifest.xml, for eg deleting any references to SDK levels in the manifest file, is NOT necessary anymore in Android Studio. ; Updating manifest.xml is NOT necessary. For example, remove any references to the SDK level in the manifest file.


The # 5 floor
For android studio users: For android studio users:

    right click the App directory right-click App directory choose the "module setting" option select "module Settings "option change the ADK Platform as what you need0 1 change the ADK Platform 2 3 click Apply click Apply

The gradle will rebuild The project automatically. gradle will automatically rebuild The project.


# 6 building
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. according to this answer, you only need to include minsdkversion in the manifest.xml, the build system will use the values in the build.gradle file and put the information into the final apk.
Because the build system needs this information anyway, this makes sense. Because the build system still needs this information, so this makes sense. You should not need to define this values two times. You do not need to define this values twice.
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 you only need to synchronize the project after changing the build. Gradle file, But Android Studio 0.5.2 displays the yellow status bar at the 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. Also note that there are at least two build. Gradle files: one main file and one file for the application /module. The one to change is in The app/module, it already includes a property minSdkVersion in a newly generated project. to change is in The app/module, It has already included the attribute minSdkVersion in the newly generated project.