리눅스 설치
시스템 요구 사항
Flutter를 설치하고 실행하기 위해서는 개발 환경이 다음과 같은 최소 요구 사항을 충족해야 합니다:
- 운영 체제: 리눅스 (64-bit)
- 저장 공간: 600 MB (IDE나 개발 도구 용량은 별도).
-
도구: Flutter는 리눅스 환경에서 아래 커멘트 라인
도구가 필요합니다.
bash
curl
-
git
2.x mkdir
rm
unzip
which
xz-utils
-
공유 라이브러리: 리눅스 환경에서는 아래 라이브러리가 사용 가능한 상태여야만 Flutter의
test
명령을 실행할 수 있습니다.-
libGLU.so.1
- mesa 패키지에 의해 제공됨 (예, Ubuntu/Debian에서는libglu1-mesa
)
-
Flutter SDK 다운로드
-
다음 설치 번들을 다운로드하여 Flutter SDK의 최신 stable 릴리즈를 받으세요:
다른 릴리즈 채널이나 이전 빌드를 받으려면 SDK 아카이브 페이지를 확인하세요.
-
다음 예시처럼 원하는 위치에 압축을 푸세요:
$ cd ~/development $ tar xf ~/Downloads/flutter_linux_vX.X.X-stable.tar.xz
-
flutter
도구를 path에 추가하세요:$ export PATH="$PATH:`pwd`/flutter/bin"
이 명령은 현재 터미널 창에 대해서만
PATH
변수를 설정합니다. Flutter를 path에 영구적으로 추가하고 싶다면, Path 추가를 참고하세요. -
선택적으로, 개발 바이너리를 사전 다운로드 하세요:
flutter
도구는 필요에 따라 플래폼별 개발 바이너리를 다운로드 합니다. 미리 artifacts를 다운로드하는 게 바람직한 경우, 아래와 같은 방법으로 iOS 및 Android 바이너리를 먼저 다운로드 할 수 있습니다:$ flutter precache
For additional download options, see
flutter help precache
.
이제 Flutter 명령을 실행할 수 있습니다!
Flutter doctor 실행
설정을 완료하는 데 필요한 플랫폼 의존성이 있는지 확인하기 위해 아래 명령을 실행하세요.
(자세한 출력을 원한다면, -v
플래그를 추가하세요)
$ flutter doctor
이 명령은 당신의 환경을 체크하고 보고서를 터미널 창에 보여줍니다. Dart SDK는 Flutter와 함께 번들로 제공되기 때문에 별도로 설치할 필요가 없습니다. 출력된 내용을 꼼꼼히 보고 설치해야 할 다른 소프트웨어가 있는지 또는 수행해야 할 추가 작업이 있는지(굵은 글씨로 표시됨) 확인하세요.
예시:
[-] Android toolchain - develop for Android devices • Android SDK at /Users/obiwan/Library/Android/sdk ✗ Android SDK is missing command line tools; download from https://goo.gl/XxQghQ • Try re-installing or updating your Android SDK, visit https://flutter-kr.io/setup/#android-setup for detailed instructions.
다음 섹션에서는 이러한 작업을 수행하고 설치 과정을 완수하는 방법을 설명합니다.
누락된 디펜던시를 설치한 후에, flutter doctor
명령을 다시 실행하여 모든 설정이 올바른지 확인할 수 있습니다.
Update your path
You can update your PATH variable for the current session at
the command line, as shown in Get the Flutter SDK.
You’ll probably want to update this variable permanently,
so you can run flutter
commands in any terminal session.
The steps for modifying this variable permanently for all terminal sessions are machine-specific. Typically you add a line to a file that is executed whenever you open a new window. For example:
- Determine the directory where you placed the Flutter SDK. You need this in Step 3.
- Open (or create) the
rc
file for your shell. For example, Linux uses the Bash shell by default, so edit$HOME/.bashrc
. If you are using a different shell, the file path and filename will be different on your machine. -
Add the following line and change
[PATH_TO_FLUTTER_GIT_DIRECTORY]
to be the path where you cloned Flutter’s git repo:$ export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin"
- Run
source $HOME/.<rc file>
to refresh the current window, or open a new terminal window to automatically source the file. -
Verify that the
flutter/bin
directory is now in your PATH by running:$ echo $PATH
Verify that the
flutter
command is available by running:$ which flutter
Update path directly
In some cases, your distribution may not permanently acquire the path when using the above directions. When this occurs, you can change the environment variables file directly. These instructions require administrator privileges:
-
Determine the directory where you placed the Flutter SDK.
-
Locate the
etc
directory at the root of the system, and open theprofile
file with root privileges.$ sudo nano /etc/profile
-
Update the PATH string with the location of your Flutter SDK directory.
if [ "`id -u`" -eq 0 ]; then PATH="..." else PATH="/usr/local/bin:...:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin" fi export PATH
- End the current session or reboot your system.
-
Once you start a new session, verify that the
flutter
command is available by running:$ which flutter
For more details on setting the path in Bash, see this StackExchange question. For information on setting the path in Z shell, see this StackOverflow question.
Android 설정
Android 스튜디오 설치
- Android 스튜디오 다운드로 및 설치.
- Android 스튜디오를 시작하고 ‘Android 스튜디오 설치 마법사’를 실행합니다. 설치 마법사는 Flutter로 Android를 개발할 때 필요한 최신 Android SDK, Android SDK 플랫폼 도구, Android SDK 빌드 도구를 설치합니다.
Android 기기 설정
Android 기기에서 Flutter 앱을 실행하고 테스트하기 위해서, Android 4.1 (API 16) 이상에서 동작하는 Android 기기가 필요합니다.
- 기기에서 개발자 옵션과 USB 디버깅을 활성화 해야합니다. 자세한 사항은 Android 문서에서 확인하실 수 있습니다.
- 윈도우인 경우: 구글 USB 드라이버를 설치하세요.
- USB케이블을 이용하여 기기를 컴퓨터에 연결하세요. 장치에 관한 메시지가 나타나면, 컴퓨터가 장치에 접근할 수 있도록 권한을 부여하세요.
- Flutter에 안드로이기 기기가 연결됐는지 확인하기 위해
터미널에서
flutter devices
명령을 실행하세요. 기본적으로, Flutter는adb
도구에 연결된 버전의 Android SDK를 사용합니다. 다른 곳에 설치된 Android SDK를 사용하고 싶다면,ANDROID_HOME
환경 변수를 해당 디렉토리로 변경해야 합니다.
Android 에뮬레이터 설정
Android 에뮬레이터에서 Flutter 앱을 실행하고 테스트하기 위해, 아래 단계를 수행하세요:
- 기기에서 VM 가속화를 활성화하세요.
- Android Studio > Tools > Android > AVD Manager를 실행하고 Create Virtual Device를 선택하세요. (Android 하위 메뉴는 Android 프로젝트 내부에 있을 때만 나타납니다.)
- 기기 해상도를 선택하고 Next를 누르세요.
- 가상화하려는 Android 버전에 맞게 1개 이상의 시스템 이미지를 선택하고 Next를 누르세요. x86 또는 x86_64 를 권장합니다.
- 에뮬레이터 성능에서, 하드웨어 가속화를 위해 Hardware - GLES 2.0를 선택하세요.
-
AVD 구성이 올바른지 확인하고 Finish를 선택하세요.
위 단계에 대한 자세한 내용은 AVD 관리를 참고하세요.
- Android 가상 기기 관리자에 있는 툴바에서 Run을 클릭하세요. 에뮬레이터가 시작되고 선택한 OS 버전과 기기의 기본 캔버스가 표시됩니다.
Web setup
To prepare to run and test your Flutter app on the web, you must install Chrome, if you haven’t already.
다음 단계
선호하는 편집기를 설정하세요.