How to change Android minSdkVersion in flutter project
It is indeed possible to increase minSdkVersion, but it took me way too much time to find it out because google searches mostly yields as result discussions about the absolute minimum Sdk version flutter should be able to support, not how to increase it in your own project.
Like in an Android Studio project, you have to edit the build.gradle
file. In a flutter project, it is found at the path ./android/app/build.gradle
.
The parameter that needs to be changed is, of course, minSdkVersion 16
, bumping it up to what you need (in this case 19).
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.projectname"
minSdkVersion 19 //*** This is the part that needs to be changed, previously was 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Seems obvious now, but took me long enough to figure it out on my own.
Android minSdkVersion with Flutter(v2.8.1)
Add these lines in your android/local.properties
sdk.dir=/Users/{username}/Library/Android/sdk
flutter.sdk=/Users/{username}/Developer/flutter
flutter.buildMode=debug
flutter.versionName=1.0.0
flutter.versionCode=1
flutter.minSdkVersion=21 // new
flutter.targetSdkVersion=30 // new
flutter.compileSdkVersion=30 // new
then in your android/app/build.gradle replace these three lines
minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger()
targetSdkVersion localProperties.getProperty('flutter.targetSdkVersion').toInteger()
versionCode flutterVersionCode.toInteger()
Set Android minSdkVersion for Flutter & Pub
Just assign your required SDK versions Like below. this will solve your compile error.
defaultConfig {
minSdkVersion 31
targetSdkVersion 31
}
or you can change flutter.minSdkVersion and flutter.targetSdkVersion directly from flutter>packages>Flutter_tools>gradle>flutter.gradle
https://stackoverflow.com/a/71440248/10936691
How to change Android minSdkVersion in flutter project
It is indeed possible to increase minSdkVersion, but it took me way too much time to find it out because google searches mostly yields as result discussions about the absolute minimum Sdk version flutter should be able to support, not how to increase it in your own project.
Like in an Android Studio project, you have to edit the build.gradle
file. In a flutter project, it is found at the path ./android/app/build.gradle
.
The parameter that needs to be changed is, of course, minSdkVersion 16
, bumping it up to what you need (in this case 19).
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.projectname"
minSdkVersion 19 //*** This is the part that needs to be changed, previously was 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Seems obvious now, but took me long enough to figure it out on my own.
How to change the minSdkVersion of a project?
Create a new AVD with the AVD Manager and set the Target to API Level 7. Try running your application with that AVD. Additionally, make sure that your min sdk in your Manifest file is at least set to 7.
Related Topics
Android: Allow Portrait and Landscape for Tablets, But Force Portrait on Phone
Best Method to Download Image from Url in Android
Get Content Uri from File Path in Android
Data Binding Class Not Generated
Android Paint: .Measuretext() VS .Gettextbounds()
Com.Google.Android.Gms:Play-Services-Measurement-Base Is Being Requested by Various Other Libraries
Remove Data from Notification Intent
Android 4.3 Menu Item Showasaction="Always" Ignored
How to Clear a Notification in Android
How to Find and Run the Keytool
Android Asynctask for Long Running Operations
Android. Fragment Getactivity() Sometimes Returns Null
How to Build the Android Sdk with Hidden and Internal APIs Available
How to Maintain Fragment State When Added to the Back Stack
Determine Whether JSON Is a JSONobject or JSONarray
Android, Canvas: How to Clear (Delete Contents Of) a Canvas (= Bitmaps), Living in a Surfaceview