Skip to content

Commit

Permalink
add: error message if minSdkValue is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
RatakondalaArun committed Jan 2, 2022
1 parent cf0d068 commit 6915e2f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ const String errorMissingPlatform =
const String errorMissingRegularAndroid =
'Adaptive icon config found but no regular Android config. '
'Below API 26 the regular Android config is required';
const String errorMissingMinSdk =
'Cannot not find minSdk from android/app/build.gradle or android/local.properties'
'Specify minSdk in either android/app/build.gradle or android/local.properties';
const String errorIncorrectIconName =
'The icon name must contain only lowercase a-z, 0-9, or underscore: '
'E.g. "ic_my_new_icon"';
Expand Down
3 changes: 3 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ Future<void> createIconsFromConfig(Map<String, dynamic> config,

if (isNeedingNewAndroidIcon(config) || hasAndroidAdaptiveConfig(config)) {
final int minSdk = android_launcher_icons.minSdk();
if (minSdk == 0) {
throw const InvalidConfigException(errorMissingMinSdk);
}
if (minSdk < 26 &&
hasAndroidAdaptiveConfig(config) &&
!hasAndroidConfig(config)) {
Expand Down

0 comments on commit 6915e2f

Please sign in to comment.