I would like to know that if I want my app to support new Android phone which api level is 9.0(Pie), what value should I set for compileSdkVersion
and targetSdkVersion
on build.gradle
.
Does anyone know about this?
It's usually recommended to use the Flutter constant for the compileSdkVersion
to always compile with the latest version of the SDK supported by Flutter : compileSdkVersion flutter.compileSdkVersion.
You can also use the constants for the targetSdkVersion
but you can define a lower number if you have not tested your app on the latest Android OS.
The minimumSdkVersion
value should never be lower than flutter.minimumSdkVersion
but can be higher if you want to be more restrictive (or if you use a dependency that requires you to raise the bar).
To be able to use your app on Android Pie (API 28), your minimumSdkVersion
should be greater or equal to 28.
/android/app/build.gradle
:android {
compileSdkVersion flutter.compileSdkVersion
defaultConfig {
applicationId "your.bundle.id"
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
}
The Flutter constants are declared in this file : https://github.com/flutter/flutter/blob/7557281fb24a3ac9cd656d60b7d286e23a3ac3d3/packages/flutter_tools/gradle/flutter.gradle
Extract :
static int compileSdkVersion = 31
static int minSdkVersion = 16
static int targetSdkVersion = 31
Of course they can change with every revision of Flutter
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With