Flutter & Firebase Android SDK Version 오류 해결

2022. 7. 15. 14:25DEV/Flutter

반응형

Firabase를 사용하기 위한 설치를 끝내고 Android Emulator에 프로젝트를 실행하니 오류가 뜬다.

Launching lib/main.dart on Android SDK built for x86 in debug mode...
lib/main.dart:1
/Users/MiKy/work/study/flutter/mychat/android/app/src/debug/AndroidManifest.xml Error:
    uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:cloud_firestore] /Users/MiKy/work/study/flutter/mychat/build/cloud_firestore/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 19,
        or use tools:overrideLibrary="io.flutter.plugins.firebase.firestore" 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 19 declared in library [:cloud_firestore] /Users/MiKy/work/study/flutter/mychat/build/cloud_firestore/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 19,
          or use tools:overrideLibrary="io.flutter.plugins.firebase.firestore" 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 2m 51s
┌─ Flutter Fix ─────────────────────────────────────────────────────────────────────────────────┐
│ The plugin cloud_firestore requires a higher Android SDK version.                             │
│ Fix this issue by adding the following to the file                                            │
│ /Users/MiKy/work/study/flutter/mychat/android/app/build.gradle:                               │
│ android {                                                                                     │
│   defaultConfig {                                                                             │
│     minSdkVersion 19                                                                          │
│   }                                                                                           │
│ }                                                                                             │
│                                                                                               │
│ Note that your app won't be available to users running Android SDKs below 19.                 │
│ Alternatively, try to find a version of this plugin that supports these lower versions of the │
│ Android SDK.                                                                                  │
│ For more information, see:                                                                    │
│ https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration                 │
└───────────────────────────────────────────────────────────────────────────────────────────────┘
Exception: Gradle task assembleDebug failed with exit code 1
Exited

Cloud Firestore를 사용하려면 Android SDK의 최소 버전이 19 이상이 되어야 한단다.

/android/app/build.gradle 파일에서 minSdkVersion 설정을 19로 변경해준다.

android {
    ...
    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.mychat"
        // 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 // * 기본 설정
        minSdkVersion 19 
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }
}
반응형