For the Projects Created After Flutter 2.8 Update
To change Android minSdkVersion in Flutter for the project created after the 2.8 update, you have to make changes in the local.properties file and then reference the new variable from the local.properties file inside the build.gradle file.
Here are the steps:
- Locate the
local.properties
file under theproject_folder/android/local.properties
- Inside the local.properties file, add the line as
flutter.minSdkVersion=21
- Now, open the
build.gradle
file under theproject_folder/android/app/build.gradle
- Find the
defaultConfig
section update theminSdkVersion
to thelocalProperties.getProperty(‘flutter.minSdkVersion’).toInteger()
. - Inside the terminal, run the
flutter clean
command. - Re-run your app.
Source: https://www.flutterbeads.com/change-android-minsdkversion-in-flutter/