본문 바로가기

Flutter

[Flutter] 개발환경 구축하기 (Xcode, Flutter SDK, Android Studio)

728x90

Flutter를 개발하기 위해선 일단 개발환경을 구축해야한다. 

제일 기본적으로 XCode , Flutter SDK, 안드로이드 스튜디오를 설치해야한다. 

 

Mac 유저임으로 Mac 관점에서 설명을 하자면

 

Step .1

 

1. App Store 에서 Xcode 를 설치를 한다. 

 

2.Flutter SDK 를 설치한다. 

https://docs.flutter.dev/get-started/install/macos/desktop?tab=download#install-the-flutter-sdk

 

Start building Flutter native desktop apps on macOS

Configure your system to develop Flutter desktop apps on macOS.

docs.flutter.dev

 

다운로드

 

Home 으로 가서 설치를 한다. (User name 의 폴더. ex - jang )

커맨드 , 쉬프트, '.' 을 눌러서 안보이는 파일을 보이게 해준다.

 

.zshrc 파일 안에 Path 설정을 추가해준다 (파일이 없을 경우 만들어 주면 됨.) 

export PATH=$HOME/flutter/bin:$PATH

 

 

 

3. Android Studio 환경을 만들어준다 .

Setting - Plugins 에서 Flutter 를 설치해준다.

 

Setting - Apperance & Behavior - System Settings - Android Sdk - Sdk Tools 에서 3번째 줄 설치 

 

 

 

Step .2

터미널을 들어간다. 

flutter doctor 를 쳐서 확인해 본다 . 이렇게 나오면 정상이다. 

[✓] Flutter (Channel stable, 3.19.3, on macOS 14.1 23B2073 darwin-arm64, locale
    ko-KR)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] VS Code (version 1.87.1)
[✓] VS Code (version 1.78.0)
[✓] Connected device (2 available)
[✓] Network resources

 

 

하지만 나는 이런식으로 나와 있기 때문에 천천히 풀어가고자 한다. 터미널에서 하라는 대로 하면 간단하다. 

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.3, on macOS 14.1 23B2073 darwin-arm64, locale
    ko-KR)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor
      --android-licenses
[!] Xcode - develop for iOS and macOS (Xcode 15.3)
    ✗ Unable to get list of installed Simulator runtimes.
    ✗ 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 (version 2022.2)
[✓] VS Code (version 1.87.1)
[✓] VS Code (version 1.78.0)
[✓] Connected device (2 available)
[✓] Network resources

! Doctor found issues in 2 categories.
zsh: command not found: --android-licenses
➜  ~ git:(master) ✗ flutter doctor --android-licenses

 

 

1. 안드로이드 에러 이슈 해결 

license 설정이 안되어있다고 말하니  터미널에 flutter doctor --android-licenses 를 쳐준다.

 

//중간생략

August 15, 2011
---------------------------------------
Accept? (y/N): y


January 16, 2019
---------------------------------------
Accept? (y/N): y


November 19, 2013
---------------------------------------
Accept? (y/N): y

Accept? (y/N): y
All SDK package licenses accepted

 

2. Xcode 에러 이슈 해결 

CocoaPods 를 설치해줘야한다고 한다.

https://guides.cocoapods.org/using/getting-started.html#installation

 

CocoaPods Guides

CocoaPods is fully open-sourced, so it depends on community contributions to get better. If you're looking to start working on CocoaPods, this is the place to start.

guides.cocoapods.org

 

터미널에 입력

sudo gem install cocoapods

 

마지막에 또 에러가 생성됐다.

ERROR:  Error installing cocoapods:
	The last version of drb (>= 0) to support your Ruby & RubyGems was 2.0.6. 
    Try installing it with `gem install drb -v 2.0.6` and then running the current
    command again drb requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210.

 

버전이 낮다고  sudo gem install drb -v 2.0.6 이게 필요한다고 한다.

 

sudo gem install drb -v 2.0.6 터미널에 입력

ERROR:  Error installing cocoapods:
	The last version of activesupport (>= 5.0, < 8) to support your Ruby & RubyGems 
    was 6.1.7.7. Try installing it with `gem install activesupport -v 6.1.7.7` and 
    then running the current command again activesupport requires Ruby 
    version >= 2.7.0. The current ruby version is 2.6.10.210.

 

또 에러가 생겼다 .  시키는 대로 sudo gem install activesupport -v 6.1.7.7 입력

 

다시 flutter doctor 를 입력해서 확인해 본다 .

➜  ~ git:(master) ✗ flutter doctor                           
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.3, on macOS 14.1 23B2073 darwin-arm64, locale
    ko-KR)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[!] Xcode - develop for iOS and macOS (Xcode 15.3)
    ✗ Unable to get list of installed Simulator runtimes.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] VS Code (version 1.87.1)
[✓] VS Code (version 1.78.0)
[✓] Connected device (2 available)
[✓] Network resources

 

대부분의 에러는 해결이 되었지만 또 해결이 안 된 것이 있다. 이 부분은 구글링을 해서 해결을 했는데 방법은 바로 .

xcodebuild -downloadPlatform iOS  이것이었다. 터미널에 입력

 

flutter doctor                  
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.3, on macOS 14.1 23B2073 darwin-arm64, locale
    ko-KR)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] VS Code (version 1.87.1)
[✓] VS Code (version 1.78.0)
[✓] Connected device (2 available)
[✓] Network resources

 

플러터 개발환경 구축 완성 

참고로 명령어는 zsh 이고 만약 bash 라면 zsh 로 바꾸길 권장한다.