728x90
728x90
Error: uses-sdk:
minSdkVersion 19 cannot be smaller than version 21 declared in library
가끔씩 pub dev에서 패키지를 다운로드하고 디버깅 모드를 돌리면 제목과 같은 오류가 발생할 때가 있다
매우 간단한 오류인데 왜 오류가 발생하는지와 해결방법에 대해서 알아보겠다
C:\Users\supabase\android\app\src\debug\AndroidManifest.xml Error: uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in library [:kakao_flutter_sdk_common] C:\Users\wjddm\flutterN\package\supabase\build\kakao_flutter_sdk_common\intermediates\merged_manifest\debug\AndroidManifest.xml as the library might be using APIs not available in 19 Suggestion: use a compatible library with a minSdk of at most 19, or increase this project's minSdk version to at least 21, or use tools:overrideLibrary="cohttp://m.kakao.sdk.flutter" 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 with multiple errors, see logs* 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.orgBUILD FAILED in 24s
왜 발생하는가?
결론부터 말하면 사용하는 라이브러리 예시에서는 kakao_flutter_sdk_common의 minSdkVersion 보다 낮기 때문에 발생하는 오류입니다
💡 minSdkVersion 란?
Android 앱이 실행되는데 최소 Android 버전을 나타낸다
여기에서 프로젝트의 android > app > build.gradle 에서 defaultConfig를 보면 나온다
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.supabase"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
//📲 최소 버전전을 flutter 기본세팅으로 되어있다
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
이때 flutter.minSdkVersion은 기본적으로 16의 값을 가지게 된다
kakao_flutter_sdk_common의 minSdkVersion은 최소 16보단 높다는 말이 되겠다
그렇다면 해결 방법은 어떻게 될까?
해결 방법
사실 해결 방법은 너무 간단하다
minSdkVersion의 값을 21로 조정해주면 웬만한 패키지는 돌아갈 것입니다
defaultConfig {
...
//📲 수정한 minSdkVersion 값
minSdkVersion 21
...
}
💡 다만 고려할 점이라면 Android 5.0 미만의 기기에서는 개발하는 앱을 실행할 수 없게 됩니다
그래서 만약 사용할 패키지가 minSdkVersion 19를 지원한다면 호환이 가능하게 해주는 방법도 있습니다
이번 포스팅으로 매우 간단하지만 설정을 해주지 않으면
앱이 구동이 안되는 오류에 대해서 알아보았습니다
그럼 코딩이 쉬워지는 그날까지!!
![](https://t1.daumcdn.net/keditor/emoticon/niniz/large/038.gif)
728x90
300x250