How to Change Android minSdkVersion in Flutter?

Flutter builds the project at a time and gets an error of minSdkVersion in flutter. The flutter run time problem is that sometimes, We need to change its value to a higher value of flutter. won't work on the default minSdkVersion value 16. Google Play Store allows minSdkVersion to be 20 or above in mobile application.

 FAILURE: Build failed with an exception.

  * What went wrong:

  Execution failed for task ':app:processDebugManifest'.

  > Manifest merger failed : uses-sdk:minSdkVersion 16 cannot    be smaller than version 19 declared in library    [:flutter_blue]               flutter_blue/intermediates/manifests/full/debug/
   AndroidManifest.xml  as the library

  might be using APIs not available in 16

  Suggestion: use a compatible library with a minSdk of at most    16 or increase this project's minSdk version to at least 19

Flutter 2.8 or later

Build.gradle update

Before updating to flutter 2.8

 android {
compileSdkVersion 30

defaultConfig {
applicationId ""
minSdkVersion 21 // change minSdkVersion here
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true

After updating to flutter 2.8

 android {
compileSdkVersion flutter.compileSdkVersion
defaultConfig {
applicationId ""
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName

You should change from by the following line

flutter.minSdkVersion=23 //added line

Now re-restart your flutter application.

Happy coding!

365Bloggy May 28, 2024
Share this post