Home > OS >  Which file contains a list of the following variables?
Which file contains a list of the following variables?

Time:06-08

Within ../android/app/build.gradle, there is a section that looks like this:

android {
  defaultConfig {
    minSdkVersion flutter.minSdkVersion
    targetSdkVersion flutter.targetSdkVersion
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
  }
}

Now, flutter.minSdkVersion seems to be a variable located in which file within my project?

CodePudding user response:

It is the default values flutter takes.

You should updates these as per needed. For latest flutter android build, it should be

android {
  defaultConfig {
    minSdkVersion 21
    targetSdkVersion 31
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
  }
}

CodePudding user response:

You have to go to \android\local.properties

Then add

flutter.minSdkVersion = 26 // the version is up to your needs.
flutter.targetSdkVersion = 32 

After that return to defaultConfig of build.gradle and call it like this :

defaultConfig {
    minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger()
    targetSdkVersion localProperties.getProperty('flutter.targetSdkVersion').toInteger()
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    }

Don't forget to launch a flutter clean flutter pub get and then flutter run

  • Related