Firestore package가 update되면서 최소 sdk version이 16에서 19로 변경된 것 같다.
그래서 안드로이드로 build를 해보려고 하면 에러가 정말 많다.
첫번째 에러는 다음과 같았다.
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/kangminlee/Desktop/code/flutter/offline_toy/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 45s Running Gradle task 'assembleDebug'... 46.8s
내용은 최소 sdk version이 16으로 되어 있어서 firestore와 호환이 안된다는 것이었다. 해결 방안은 app 폴더의 build.gradle을
defaultConfig {
// TODO: Specify your own unique Application ID (<https://developer.android.com/studio/build/application-id.html>).
applicationId "com.example.offline_toy"
// 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 19
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
이렇게 minSdkVersion을 19로 바꾸어 주면 됐다.
하지만 또 에러가 났다.
FAILURE: Build failed with an exception.
- Where: Build file '/Users/kangminlee/Desktop/code/flutter/offline_toy/android/build.gradle' line: 26
- What went wrong: A problem occurred evaluating root project 'android'.
A problem occurred configuring project ':app'. Failed to notify project evaluation listener. com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle Cannot invoke method substring() on null object
여기서는 compileSdkVersion이 명시되어 있지 않다는 것이었다. 그래서 동일한 파일을
android {
ndkVersion flutter.ndkVersion
compileSdkVersion 31
buildToolsVersion '31.0.0'
이렇게 수정해주었다.
Result
https://github.com/growbook91/offline_toy
GitHub - growbook91/offline_toy
Contribute to growbook91/offline_toy development by creating an account on GitHub.
github.com
'flutter' 카테고리의 다른 글
flutter에서 Inspector 사용하는 법 (1) | 2022.06.29 |
---|---|
특정화면에서 flutter를 실행하는 법 (0) | 2022.06.29 |
Local Notification (0) | 2022.06.27 |
Firebase Cloud Function (0) | 2022.06.27 |