반응형
플러터(Flutter)에서 webview_flutter 안되는 오류 해결
안녕하세요 개발하며 달리는 쿼카입니다.
이번에 플러터에서 webview_flutter를 이용해서 기존에 개발한 웹의 화면을 이용하여 앱을 구성하는 웹뷰를 사용하려했는데요, 계속 진행이 안되어서 에러를 봤더니 다음과 같은 오류가 났습니다.
Launching lib/main.dart on sdk gphone x86 in debug mode...
lib/main.dart:1
/Users/user/projects/flutter/app/android/app/src/debug/AndroidManifest.xml Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:webview_flutter_android] /Users/user/projects/flutter/app/build/webview_flutter_android/intermediates/library_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.webviewflutter" 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 [:webview_flutter_android] /Users/user/projects/flutter/app/build/webview_flutter_android/intermediates/library_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.webviewflutter" 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 6s
┌─ Flutter Fix ─────────────────────────────────────────────────────────────────────────────────┐
│ The plugin webview_flutter_android requires a higher Android SDK version. │
│ Fix this issue by adding the following to the file │
│ /Users/user/projects/flutter/app/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
해당 에러를 어떻게 해결할 수 있을까요?
방법
에러 메시지 대부분이 그렇듯이 해당 에러 또한 에러 메시지를 자세하게 확인하면 해결이 가능했는데요, /android/app/build.gradle 파일에 들어가서 특정 코드를 추가해주어야합니다.
해당 파일에 들어간 뒤에 minSdkVersion 19라는 값을 설정해야 안드로이드 에뮬레이터에서 정상적으로 webview_flutter를 이용하여 웹뷰로 화면을 보여줄 수 있습니다
지금까지 플러터(Flutter)에서 webview_flutter 안되는 오류 해결하는 방법에 대해서 알아보았는데요, 해당 글이 도움이 되었다면 좋아요 한 번 부탁드립니다~!
반응형