Skip to content

Commit

Permalink
refactor: added 21 as default min_sdk_android
Browse files Browse the repository at this point in the history
  • Loading branch information
RatakondalaArun committed Aug 1, 2022
1 parent 0f3ad18 commit f58fdce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icon/icon.png"
min_sdk_android: 21 # android min sdk min:16
min_sdk_android: 21 # android min sdk min:16, default 21
web:
generate: true
image_path: "path/to/image.png"
Expand Down
5 changes: 3 additions & 2 deletions lib/android.dart
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ List<String> _transformAndroidManifestWithNewLauncherIcon(List<String> oldManife
/// - local.properties: `'android/local.properties'`
///
/// If found none returns 0
int? minSdk() {
int minSdk() {
final androidGradleFile = File(constants.androidGradleFile);
final androidLocalPropertiesFile = File(constants.androidLocalPropertiesFile);

Expand All @@ -281,7 +281,8 @@ int? minSdk() {
// first check build.gradle, then local.properties, then flutter.gradle
return _getMinSdkFromFile(androidGradleFile) ??
_getMinSdkFromFile(androidLocalPropertiesFile) ??
_getMinSdkFlutterGradle(androidLocalPropertiesFile);
_getMinSdkFlutterGradle(androidLocalPropertiesFile) ??
constants.androidDefaultAndroidMinSDK;
}

/// Retrieves the minSdk value from [File]
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Future<void> createIconsFromConfig(
}

if (isNeedingNewAndroidIcon(config) || hasAndroidAdaptiveConfig(config)) {
final int minSdk = config['min_sdk_android'] ?? android_launcher_icons.minSdk() ?? 0;
final int minSdk = config['min_sdk_android'] ?? android_launcher_icons.minSdk();
if (minSdk == 0) {
throw const InvalidConfigException(errorMissingMinSdk);
}
Expand Down

0 comments on commit f58fdce

Please sign in to comment.