12

Before updating to Flutter 2.8

defaultConfig {
    applicationId "com.kim.app"
    minSdkVersion 16
    targetSdkVersion 30
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    multiDexEnabled true
}

After updating to Flutter 2.8:

defaultConfig {
        applicationId "com.example.app"
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

How can I update minSdkVersion higher? I cannot find the target "flutter.minSdkVersion" variable anywhere.

pckim
  • 155
  • 1
  • 7
  • 1
    follow this answer https://stackoverflow.com/questions/52060516/how-to-change-android-minsdkversion-in-flutter-project/70316521#70316521 – Jahidul Islam Dec 11 '21 at 16:01

4 Answers4

16

Go to android/local.properties

Add the following ie define the versions

  • flutter.minSdkVersion=21
  • flutter.targetSdkVersion=30
  • flutter.compileSdkVersion=30

Once done goto android/app/build.gradle and add the following

minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger()

targetSdkVersion localProperties.getProperty('flutter.targetSdkVersion').toInteger()

Then goto android/build.gradle

Update the Kotlin version

ext.kotlin_version = '1.6.0'

Vivek j
  • 161
  • 4
12

just replace flutter.minSdkVersion with your value ,

defaultConfig {
        applicationId "com.example.app"
        minSdkVersion 21
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

Dipak Prajapati
  • 360
  • 1
  • 6
6

Just replace flutter.minSdkVersion to your target version.

flutter.minSdkVersion is found in https://github.com/flutter/flutter/blob/stable/packages/flutter_tools/gradle/flutter.gradle

rickimaru
  • 2,275
  • 9
  • 13
0

Go to android/local.properties there you can change configuration