플러터 초기 설정 실행시 설정 문제점에 대해서 체크해주는 플러터 닥터(flutter doctor)를 제공하고 있습니다.
커맨드를 실행해서 설정에 문제가 있는지 없는지에 대해서 체크를 해 줍니다.
초기 설정후 거의 99.9% 발생하는 문제에 대해서 간략하게 해결하는 방법에 대해서 정리해 보았습니다.
happymemoryies %> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.7, on macOS 13.2.1 22D68 darwin-arm64, locale ko-JP)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✗] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin
usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] VS Code (version 1.76.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
! Doctor found issues in 3 categories.
[✗] Android toolchain - develop for Android devices
안드로이드 SDK가 설치되지 않아서 발생하는 항목 입니다.
SDK Manager를 설치하거나 Android Studio를 설치 하면 SDK가 설치 되기 때문에 해결이 가능합니다.
SDK Manager는 커맨드 베이스로 설치 진행을 해야하기 때문에 안드로이드 설정에 익숙한 분에게만 추천하고 귀찮거나 쉽게 설정을 원한다면 Android Studio 설치를 추천 합니다.
SDK Manager
Android Studio
- https://developer.android.com/studio/index.html
[✗] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete
✗ CocoaPods not installed.
Xcode 설치
iOS기반의 빌드(컴파일)을 위해서 필요한 툴 입니다. IDE와 SDK가 포함되어 있기 때문에 용량이 꽤 큽니다. (7.3GB)
Xcode
CocoaPods 설치
macOS 빌드를 위해 CocoaPods가 필요합니다.
CocoaPods
happymemoryies $> sudo gem install cocoapods
Fetching cocoapods-1.12.0.gem
Successfully installed concurrent-ruby-1.2.2
Successfully installed i18n-1.12.0
Successfully installed tzinfo-2.0.6
ERROR: Error installing cocoapods:
The last version of activesupport (>= 5.0, < 8) to support your Ruby & RubyGems was 6.1.7.3. Try installing it with `gem install activesupport -v 6.1.7.3` and then running the current command again
activesupport requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210.
커맨드를 실행하면 위 처럼 에러가 발생하는 경우가 있습니다. 흥분하지 마시고 차분이 메세지를 보면 버전을 지정해서 설치하라고 되어 있습니다. 아래 커맨드를 실행 합니다.
happymemoryies $> sudo gem install activesupport -v 6.1.7.3
gem을 이용해서 Cocoapods를 설치 합니다.
macbook $> sudo gem install cocoapods
Installing ri documentation for cocoapods-1.12.0
Done installing documentation for nap, fuzzy_match, httpclient, algoliasearch, ffi, ethon, typhoeus, netrc, public_suffix, addressable, cocoapods-core, claide, cocoapods-deintegrate, cocoapods-downloader, cocoapods-plugins, cocoapods-search, cocoapods-trunk, cocoapods-try, molinillo, atomos, colored2, nanaimo, rexml, xcodeproj, escape, fourflusher, gh_inspector, ruby-macho, cocoapods after 14 seconds
29 gems installed
어디서나 실행할 수 있도록 패스 추가를 합니다.
happymemoryies $> export GEM_HO ME=$HOME/.gem
happymemoryies $> export PATH=$GEM_HOME/bin:$PATH
# 제대로 들어갔나 패스 확인하기
macbook $> echo $path
/Users/macbook/.gem/bin.....이하생략
거의 다 왔습니다.
처음 flutter doctor를 실행했을때 나왔던 설정 오류들은 모두 처리했으니 다시한번 닥터를 실행해 보죠.
happymemoryies $> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.7, on macOS 13.2.1 22D68 darwin-arm64, locale ko-JP)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.76.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
! Doctor found issues in 1 category.
위처럼 나왔다면 99.9% 끝났다고 봐도 됩니다.
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
각 버전의 안드로이드 SDK를 사용하기 위한 약관 동의가 필요합니다. 커맨드 실행하고 y 키만 연타 하시면 됩니다.
happymemoryies $> flutter doctor --android-licenses
[=======================================] 100% Computing updates...
6 of 7 SDK package licenses not accepted.
Review licenses that have not been accepted (y/N)? y
중간생략
All SDK package licenses accepted
다시 flutter doctor를 실행해 봅니다.
말끔히 해결 되었습니다.
happymemoryies $> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.7, on macOS 13.2.1 22D68 darwin-arm64, locale ko-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.76.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
• No issues found!
'Development Memories > FLUTTER' 카테고리의 다른 글
플러터(Flutter) v3.0.0 업데이트 요약 (0) | 2023.01.22 |
---|