Changing API level Android Studio
When you want to update your minSdkVersion in an existent project...
- Update
build.gradle(Module: app)
- Make sure is the one under Gradle Script and it is NOTbuild.gradle(Project: yourproject)
.
An example of 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)
For beginners in Android Studio "Sync gradle button" is located in
Tools -> Android -> Sync Project with Gradle Files "Rebuild project"
Build -> 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"). 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.
Changing (lowering) minSDK (API level) for Android Studio (2020+)
Based on the comments by Ricky Mo.
The problem is that the default is the "Project View", which contains a build.gradle
file that that defines the Kotlin version and the Android Studio Gradle plugin version.
The build.gradle
file that defines the minSDK is found in the app
folder (screenshot).
Alternatively you can switch from the "Project View" to Android. From the dropdown menu that open when you click "Project" (screenshot, highlighted).
Is it possible to change API level of mobile and test our app by using android app?
No deployed version of OS of any sort contains its previous releases (don't confuse this with OS backward compatibility). The simplest way to test on various versions of given platform is to use emulator(s).
For Android see either stock one or 3rd party ones like Genymotion or Blue Stacks.
change targets API level to 28 SDK
edit
use this in your dependencies
implementation 'com,android.support:support-v4:28.0.0'
try this and let me know if solved the problem.
Related Topics
How to Open a Url in Android'S Web Browser from My Application
How to Get the Android Device'S Primary E-Mail Address
Notification Not Showing in Oreo
How to Avoid Reverse Engineering of an Apk File
Make a Link in the Android Browser Start Up My App
How to Show Current Location on a Google Map on Android Marshmallow
How to Prevent a Dialog from Closing When a Button Is Clicked
How to Execute Dex: Method Id Not in [0, 0Xffff]: 65536
Passing Data Between a Fragment and Its Container Activity
Standard Android Button With a Different Color
How to Refresh Android Listview
Android Imageview Scaling and Translating Issue
Android: Check Whether the Phone Is Dual Sim
Onactivityresult Method Is Deprecated, What Is the Alternative
Retrieving Android API Version Programmatically