How to change the minSdkVersion of a project?
I have been building a project and testing it on the Android emulator.
I realized that I set the minSdkVersion
to 10. Now, I have a phone to test the program on, but its sdk version is 7.
I tried to go into the manifest file, and change the sdk version to 7, but every time I run the program, it crashes.
How can I rebuild or change the sdk version to a lower number (from 10 to 7), so that I can make sure my app is able to run on older phones?
In your app/build.gradle
file, you can set the minSdkVersion
inside defaultConfig
.
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.name.app"
minSdkVersion 19 // This over here
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
Set the min SDK version within your project's AndroidManifest.xml file:
<uses-sdk android:minSdkVersion="4"/>
What exactly causes the crash? Iron out all crashes/bugs in minimum version and then test in higher versions.
This is what worked for me:
In the build.gradle
file, setting the minSdkVersion
under defaultConfig
:
Good Luck...