플러터 설치는 아래와 같이 크게 2단계로 이루어져 있다.
플러터 공식웹사이트에 가서 SDK를 다운받아 설치하는 방법도 있지만 터미널에서 명령어를 입력하여 간단하게 설치하는 방법을 소개하고자 한다.
윈도우에서는 chcolatey를 이용하여 설치한다. 설치를 위해서는 chcolatey를 먼저 설치해야한다.
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco install flutter
맥은 hombrew를 사용해서 Flutter를 설치한다.
/bin/bash -c "$(curl -fsSL [https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh](https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh))"
brew install --cask flutter
윈도우,맥 둘다 명령어를 입력하면 패스도 알아서 적용을 해준다.
안드로이드 스튜디오와 Xcode를 설치해야한다. Xcode의 경우 AppStore에 검색을 하여 설치한다.
IOS의 개발을 위해서는 반드시 Mac OS를 사용해야한다. 윈도우에서는 개발이 불가능하다... 처음에는 윈도우에서도 가능한줄 알았다.
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See http://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[!] Xcode - develop for iOS and macOS (Xcode 14.2)
✗ 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.
[!] Android Studio (version 2022.1)
✗ Unable to find bundled Java version.
Android toolchain 에러
Android Studio의 SDK Manager 이동 후 Android SDK Command-line Tools 체크 후 Apply 시 자동 설치
설치 완료 후 터미널에서 아래 명령어 입력
flutter doctor --android-licenses
Xcode 에러
sudo gem install cocoapods
Android Studio 에러
안드로이드 스튜디오가 설치된 폴더로 이동 후 jbr폴더를 jre이름으로 심볼릭 링크를 걸어준다.
cd /Applications/Android\ Studio.app/Contents/
ln -s jbr jre
이때 ln operation not permitted 같은 메시지가 나올경우
시스템 설정 → 개인정보 보호 및 보안 → 전체 디스크 접근 권한에서 사용하는 터미널의 권한을 활성화 해주면 된다.
모든게 다 귀찮다면 https://dartpad.dev에 접속해 smaple의 플러터 로고가 있는 Counter를 실행하면 간단하게 데모를 사용할 수 있다. 단점으로는 다른 파일을 만들지는 못한다...
포스트의 내용은 노마드 코더의 플러터 강의와 저의 삽질로 작성하였습니다.