[flutter] Android - Package간 sdk version 등이 맞지 않아 오류가 발생하는 경우

[flutter] Android - Package간 sdk version 등이 맞지 않아 오류가 발생하는 경우

에러 문구:

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
...\android\app\src\debug\AndroidManifest.xml Error:
	uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:some_package] ...\intermediates\merged_manifest\debug\AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16, or increase this project's minSdk version to at least 21, or use tools:overrideLibrary="com.
some_package" to force usage (may lead to runtime failures)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:some_package] ...\build\awesome_notifications\intermediates\merged_manifest\debug\AndroidManifest.xml as the library might be using APIs not available in 16
  	Suggestion: use a compatible library with a minSdk of at most 16,
  		or increase this project's minSdk version to at least 21,
  		or use tools:overrideLibrary="com.some_package" to force usage (may lead to runtime failures)
* Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 12s
┌─ Flutter Fix ─────────────────────────────────────────────────────────────────────────────────┐ │ The plugin awesome_notifications requires a higher Android SDK version. │ │ Fix this issue by adding the following to the file │ │ ...\android\app\build.gradle: │ │ android { │ │ defaultConfig { │ │ minSdkVersion 21 │ │ } │ │ } │ │ │ │ Following this change, your app will not be available to users running Android SDKs below 21. │ │ Consider searching for a version of this plugin that supports these lower versions of the │ │ Android SDK instead. │ │ For more information, see: │ │ https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration │ └───────────────────────────────────────────────────────────────────────────────────────────────┘ Exception: Gradle task assembleDebug failed with exit code 1

해결방법:

"android/local. Properties"

flutter.compileSdkVersion=31
flutter.minSdkVersion=21
flutter.targetSdkVersion=31

"android/app/build.gradle"

...
def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
if (flutterMinSdkVersion == null) {
flutterMinSdkVersion = '21'
}

def flutterTargetSdkVersion = localProperties.getProperty('flutter.targetSdkVersion')
if (flutterTargetSdkVersion == null) {
flutterTargetSdkVersion = '30'
}
...

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.yagapp.apps.workout_timer"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
// minSdkVersion flutter.minSdkVersion (x)
// targetSdkVersion flutter.targetSdkVersion (x)
minSdkVersion flutterMinSdkVersion.toInteger() (o)
targetSdkVersion flutterTargetSdkVersion.toInteger() (o)
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}


댓글

이 블로그의 인기 게시물

Next.js에서 자연스러운 Page Transition 방법

[Windows] Chocolatey upgrade