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> 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. I> 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> 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. I> , 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. I> 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. I> Edit: Sorry, I see you are using Android Studio, not Eclipse. But I guess there is a similar ‘clear lint markers’ in Studio somewhere I> , 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… I> rebuild, everything should be fine…
# 4 floor
When you want to update your minSdkVersion in an existent project… I> 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) I> 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: I> build.gradle : b b>
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) I> synchronous gradle button (refresh all gradle projects can also work) b>
For beginners in Android Studio "Sync gradle button" is located in Tools -> Android -> Sync Project with Gradle Files "Rebuild project" Build -> Rebuild Project I> 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 I> Rebuild project b>
After updating the build.gradle 's minSdkVersion
, You have to click on the button to sync gradle file (" sync Project with gradle files"). I> update build. After gradle minSdkVersion
, you must click on the button gradle sync file (' sync Project with cradle files'). That will clear the marker. I> 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. I> ; 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: I> For android studio users: b>
- right click the App directory I> right-click App directory b> choose the "module setting" option I> select "module Settings "option b> change the ADK Platform as what you need I>0 1 change the ADK Platform 2 3 click Apply I> click Apply b>
The gradle will rebuild The project automatically. I> 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. I> 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. I> Because the build system still needs this information, so this makes sense. You should not need to define this values two times. I> 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 I> 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
I>Also note there at least two build. Gradle
files: one master and one for the app/module. I> 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. I> to change is in The app/module, It has already included the attribute minSdkVersion
in the newly generated project.
Read More:
- Android studio change package name
- Android Studio Series: after Android studio is opened, the project window will not be displayed.
- Android Studio – add configuration for Android studio
- Android Studio | Failed to find target with hash string ‘android-26’ in: D:\Android\sdk
- Android Studio sync build.gradle appears: Failed to resolve: com.android.support:appcompat problem
- Solution of fileuriexposedexception for Android 7.0 behavior change
- Android Studio Error: Invoke-customs are only supported starting with Android O (–min-api 26)
- Error in Cordova project execution command after Android studio upgrade: could not find gradle wrapper within Android SDK
- When Android Studio runs the app, it prompts Error: Please select Android SDK
- Android studio compilation error: style attribute ‘@ android:attr/windowEnterAnimation ‘not found the ultimate solution
- Android studio AAPT: error: attribute android:requestLegacyExternalStorage not found.
- [error record] as compilation error (Android support plugin version is too high | upgrade Android studio to the latest version)
- android studio:Error inflating class android.support.v4.widget.SwipeRefreshLayout
- Android studio “sync project with gradle files” button disappears
- About Android studio error: (26,13) failed to resolve: com.android.support : appcompat-v7:27. + error
- Android API 27 and above use HTTP protocol request mode
- How to Fix Android Error:This Gradle plugin requires Studio 3.0 minimum
- NACOS error com.alibaba.nacos.api.exception.NacosException: failed to req API:/api//nacos/v1/ns/instance
- Install of Android studio_ FAILED_ OLDER_ Solutions to SDK
- Error launching Android Studio