Appearance
Flutter Android Build Configuration
Overview
Like in an Android Studio project, you have to edit the build.gradle file. In a Flutter project, it is found at the path ./android/app/build.gradle
.
Configuration Location
File Path: ./android/app/build.gradle
defaultConfig Section
gradle
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.projectname"
minSdkVersion 19 //*** This is the part that needs to be changed, previously was 16
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Configuration Parameters
applicationId
- Purpose: Unique identifier for your app on Google Play Store
- Example:
"com.example.projectname"
- Note: This should be unique and follow reverse domain naming convention
minSdkVersion
- Purpose: Minimum Android API level your app supports
- Example:
19
(Android 4.4 KitKat) - Note: Previously was
16
, updated to19
for better compatibility
targetSdkVersion
- Purpose: The API level your app is designed to run on
- Example:
31
(Android 12) - Note: Should be updated to match the latest stable Android version
versionCode
- Purpose: Internal version number used by Google Play Store
- Example:
1
- Note: Must be incremented for each release
versionName
- Purpose: Version string displayed to users
- Example:
"1.0"
- Note: Human-readable version identifier
testInstrumentationRunner
- Purpose: Specifies the test runner for instrumented tests
- Example:
"android.support.test.runner.AndroidJUnitRunner"
Important Notes
- Always update
minSdkVersion
when required by dependencies - Increment
versionCode
for each app store release - Keep
targetSdkVersion
up to date with latest Android versions - Ensure
applicationId
is unique before publishing to Play Store