Flutter 개발 세팅

nona·2021년 5월 14일
0

Flutter

목록 보기
1/1

Google 플러터에 입문하기 위한 세팅을 해 봅니다.
https://flutter-ko.dev

환경

  • 2021년 5월
  • Xcode 12.5
  • Android Studio 4.2.1
  • Flutter 2.0.6
  • M1 맥미니

Xcode 설치

  • Xcode 맥 앱스토어 설치
  • CocoPods 설치
    • Swift 및 Objective-C 코코아 프로젝트의 종속성 관리자 (Flutter 에서 필수)
$ brew install cocoapods
... ruby 관련 PATH등 설정하라고 하는데 일단 그냥 둠

Android Studio 설치

$ flutter doctor --android-licenses
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
	at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
	at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
	at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
	at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
	at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 5 more

Flutter

  • 다운로드
  • 적당한 디렉토리에 압축 해제 후 /flutter/bin PATH 설정
    • zsh 이므로 nano ~/.zprofile 하단에 export PATH="$PATH:/[절대경로]/flutter/bin" 추가
  • Flutter doctor 실행
    • 설정을 완료하는데 필요한 플랫폼 의존성이 있는지 확인
$ flutter doctor
  ╔════════════════════════════════════════════════════════════════════════════╗
  ║                 Welcome to Flutter! - https://flutter.dev                  ║
  ║                                                                            ║
  ║ The Flutter tool uses Google Analytics to anonymously report feature usage ║
  ║ statistics and basic crash reports. This data is used to help improve      ║
  ║ Flutter tools over time.                                                   ║
  ║                                                                            ║
  ║ Flutter tool analytics are not sent on the very first run. To disable      ║
  ║ reporting, type 'flutter config --no-analytics'. To display the current    ║
  ║ setting, type 'flutter config'. If you opt out of analytics, an opt-out    ║
  ║ event will be sent, and then no further information will be sent by the    ║
  ║ Flutter tool.                                                              ║
  ║                                                                            ║
  ║ By downloading the Flutter SDK, you agree to the Google Terms of Service.  ║
  ║ Note: The Google Privacy Policy describes how data is handled in this      ║
  ║ service.                                                                   ║
  ║                                                                            ║
  ║ Moreover, Flutter includes the Dart SDK, which may send usage metrics and  ║
  ║ crash reports to Google.                                                   ║
  ║                                                                            ║
  ║ Read about data we send with crash reports:                                ║
  ║ https://flutter.dev/docs/reference/crash-reporting                         ║
  ║                                                                            ║
  ║ See Google's privacy policy:                                               ║
  ║ https://policies.google.com/privacy                                        ║
  ╚════════════════════════════════════════════════════════════════════════════╝


Running "flutter pub get" in flutter_tools...                          ⣻
   10.6s
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.6, on macOS 11.3 20E232 darwin-arm, locale ko-KR)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[!] Xcode - develop for iOS and macOS
    ✗ 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)
[] IntelliJ IDEA Ultimate Edition (version 2021.1.1)
[] VS Code (version 1.56.0)
[] Connected device (1 available)

! Doctor found issues in 3 categories.
  • CocoaPods 설치하고 Android Studio 설치 하고 flutter doctor --android-licenses 안드로이드 라이센스까지 확인 후
$ flutter doctor                   
Doctor summary (to see all details, run flutter doctor -v):
[] Flutter (Channel stable, 2.0.6, on macOS 11.3 20E232 darwin-arm, locale ko-KR)
[] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[] Xcode - develop for iOS and macOS
[] Chrome - develop for the web
[] Android Studio (version 4.2)
[] IntelliJ IDEA Ultimate Edition (version 2021.1.1)
[] VS Code (version 1.56.0)
[] Connected device (1 available)

• No issues found!

VSCode 설정

  • 플러그인 설치
    • Flutter
  • shift + cmd + p Flutter: New Application Project 선택하여 Flutter 프로젝트 생성
  • shift + cmd + p Flutter: Launch Emulator 또는 실행으로 에뮬레이터를 띄워둔 상태에서
  • main.dart 파일 Start Debugging

여기까지 하면 에뮬레이터/시뮬레이터에 표시되며 코드 변경사항이 바로 반영됩니다.
이제 Flutter를 가지고 놀 준비는 되었습니다.

profile
개발 놀이 중

0개의 댓글