티스토리 뷰

Flutter

맥북에서 Flutter 설치하기

바람사탕 2022. 6. 17. 23:53
반응형

 

설치하기 전에

설치시, 맥북 로그인 비번을 여러번 물어봅니다.

키보드로 쳐도 안보이지만, 들어갑니다.

비번 까먹지 마세요.

 

Xcode를 설치하세요 

(웹에서 다운로드 혹은 맥 앱스토어).

웹, 앱스토어 모두 Apple ID 로그인해야 받을 수 있음.

e메일, 전화번호 필수.

 

 

로그인 3번정도 해주면, Xcode설치가능.

 

리뷰가 대박이네.....(ㄸㄸㄸㄸ 떨지마라)

맥북에서 ㄷㄷㄷㄷ치면, ㄸㄸ이 되네요.

 

다운로드, 설치가 매우 느리다.

 

 

터미널, 미리보기, Xcode, Simulator

 

 

설치가 끝나면, 시뮬레이터 실행.

 

 open -a Simulator

 flutter create my_app
 cd my_app
 flutter run

위 코드를 까만창에서 실행하면, 

 

시뮬레이터 종료후, 다시실행

flutter run
flutter run
Multiple devices found:
macOS (desktop) • macos  • darwin-arm64   • macOS 12.4 21F79 darwin-arm
Chrome (web)    • chrome • web-javascript • Google Chrome 102.0.5005.115
[1]: macOS (macos)
[2]: Chrome (chrome)
Please choose one (To quit, press "q/Q"):

숫자 '1'을 누르면, 맥OS용 프로그램이 실행된다.

 

 

시뮬레이터 클릭하고, 맨위 좌측 메뉴에서, 여러가지 기기들을 실행해 볼 수 있다.

속도는 안드로이드 보다 훨씬 빠르다.

 

배포

 sudo gem install cocoapods
 pod setup

 

 

 

 

 

 

 

 

 

https://flutter-ko.dev/docs/get-started/install/macos#flutter-sdk-다운로드

 

 

맥OS에서 설치

 

flutter-ko.dev

다운로드 불가....(???)

한글 홈페이지 문제인듯.

영문홈페이지 가보니

https://docs.flutter.dev/get-started/install/macos

Intel                                                                                        Apple Silicon(M1칩???)

flutter_macos_3.0.2-stable.zip   flutter_macos_arm64_3.0.2-stable.zip

flutter_macos_arm64_3.0.2-stable.zip 다운로드 설치

 

 

다운로드된 폴더 들어가서, bin폴더의 flutter (Unix 실행파일). 실행.

실행불가.

 

마우스 우클릭 -> 열기

열기 -> 실행됨.

 

flutter doctor는 설치환경을 진단하는 기능으로, 문제가 모두 없어질때까지, 계속 설치, 확인을 반복한다.

예)
flutter doctor -v
문제 해결(설치)
flutter doctor -v
문제 해결(설치)
flutter doctor -v
....

 

Last login: Sun Jun 12 16:38:03 on console
testpc1@GBookAir ~ % /Users/git/Downloads/flutter/bin/flutter ; exit;
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
Building flutter tool...
Manage your Flutter app development.

Common commands:

  flutter create <output directory>
    Create a new Flutter project in the specified directory.

  flutter run [options]
    Run your Flutter application on an attached device or in an emulator.

Usage: flutter <command> [arguments]

Global options:
-h, --help                  Print this usage information.
-v, --verbose               Noisy logging, including all shell commands
                            executed.
                            If used with "--help", shows hidden options. If used
                            with "flutter doctor", shows additional diagnostic
                            information. (Use "-vv" to force verbose logging in
                            those cases.)
-d, --device-id             Target device id or name (prefixes allowed).
    --version               Reports the version of this tool.
    --suppress-analytics    Suppress analytics reporting when this command runs.

Available commands:

Flutter SDK
  bash-completion   Output command line shell completion setup scripts.
  channel           List or switch Flutter channels.
  config            Configure Flutter settings.
  doctor            Show information about the installed tooling.
  downgrade         Downgrade Flutter to the last active version for the current
                    channel.
  precache          Populate the Flutter tool's cache of binary artifacts.
  upgrade           Upgrade your copy of Flutter.

Project
  analyze           Analyze the project's Dart code.
  assemble          Assemble and build Flutter resources.
  build             Build an executable app or install bundle.
  clean             Delete the build/ and .dart_tool/ directories.
  create            Create a new Flutter project.
  drive             Run integration tests for the project on an attached device
                    or emulator.
  format            Format one or more Dart files.
  gen-l10n          Generate localizations for the current project.
  pub               Commands for managing Flutter packages.
  run               Run your Flutter app on an attached device.
  test              Run Flutter unit tests for the current project.

Tools & Devices
  attach            Attach to a running app.
  custom-devices    List, reset, add and delete custom devices.
  devices           List all connected devices.
  emulators         List, launch and create emulators.
  install           Install a Flutter app on an attached device.
  logs              Show log output for running Flutter apps.
  screenshot        Take a screenshot from a connected device.
  symbolize         Symbolize a stack trace from an AOT-compiled Flutter app.

Run "flutter help <command>" for more information about a command.
Run "flutter help -v" for verbose help output, including less commonly used
options.
  ╔════════════════════════════════════════════════════════════════════════════╗
  ║                 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                                        ║
  ╚════════════════════════════════════════════════════════════════════════════╝



Saving session...
...saving history...truncating history files...
...completed.
Deleting expired sessions...none found.

[프로세스 완료됨]

우측상단의 돋보기에서 '터미널'검색, 실행

터미널에서

아래 내용 입력

vim $HOME/.zshrc

 

영문으로 변경, 'I'키(--INSERT--모드)

 

아래 내용 입력

export PATH="$PATH:/Users/xxxxxxxxxxxxxxxx/Downloads/flutter/bin"
ESC키
:wq!

터미널 종료.

 

터미널 실행.

flutter doctor
Last login: Thu Jun 16 22:33:21 on ttys000
testpc1@GitsnuicBookAir ~ % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, 3.0.2, on macOS 12.4 21F79 darwin-arm, locale
    ko-KR)
    ✗ Downloaded executables cannot execute on host.
      See https://github.com/flutter/flutter/issues/6207 for more information

[✗] 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 (Cannot find Chrome executable at
    /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
[✓] Connected device (1 available)
[✓] HTTP Host Availability

! Doctor found issues in 5 categories.
testpc1@GitsnuicBookAir ~ %

 

flutter channel master
flutter doctor
testpc1@BookAir ~ % flutter channel master
Switching to flutter channel 'master'...
git: Switched to a new branch 'master'
git: Branch 'master' set up to track remote branch 'master' from 'origin'.
Successfully switched to flutter channel 'master'.
To ensure that you're on the latest build from this channel, run 'flutter upgrade'
testpc1@BookAir ~ % flutter upgrade       
Downloading Darwin arm64 Dart SDK from Flutter engine ee71e31c36cedfc7af583705434e7712c9bcae0a...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  194M  100  194M    0     0  1830k      0  0:01:48  0:01:48 --:--:-- 1909k
Building flutter tool...
Flutter is already up to date on channel master
Flutter 3.1.0-0.0.pre.1287 • channel master • https://github.com/flutter/flutter.git
Framework • revision d08a1b02ae (11 minutes ago) • 2022-06-17 01:38:09 -0400
Engine • revision ee71e31c36
Tools • Dart 2.18.0 (build 2.18.0-190.0.dev) • DevTools 2.14.0
testpc1@BookAir ~ %
flutter upgrade

2022최신 M1 맥북에서 문제가 있다.... 

안되면, 시도해볼 수 있는 명령들

flutter channel master
flutter channel stable
flutter upgrade --force
flutter clean
flutter pub cache repair
flutter doctor -v

 

 

 

안드로이드 스튜디오 설치(맥)

https://developer.android.com/studio

 

Download Android Studio and SDK tools  |  Android Developers

The official IDE for Android app developers.

developer.android.com

flutter doctor -v
...
[✗] Android toolchain - develop for Android devices
    • Android SDK at /Users/gitsn/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
      
...

경로명이 문제인듯 싶어 추가

flutter config --android-studio-dir="/Volumes/Android Studio - Chipmunk | 2021.2.1 Patch 1"

 

 

 

flutter doctor -v
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

https://www.java.com/ko/download/

Java 다운로드

 

 

경로명추가

vim $HOME/.zshrc
'I'키
export PATH="$PATH:/Volumes/Java 8 Update 321:........
:wq!

안됨......

 

 

 

 

 

 

 

 

 

[✗] Android toolchain - develop for Android devices
    • Android SDK at /Users/gitsn/Library/Android/sdk
    ✗ 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 Studio
    • Android Studio at /Volumes/Android Studio - Chipmunk | 2021.2.1 Patch
      1/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Android Studio not found at /Volumes/Android Studio - Chipmunk | 2021.2.1
      Patch 1/Contents
    • Try updating or re-installing Android Studio.
export ANDROID_HOME=$HOME/Library/Android/sdk/
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools

 

이것저것 설치하다 보니, flutter 에러가 해결되었다...;;;

[✓] Flutter (Channel stable, 3.0.2, on macOS 12.4 21F79 darwin-arm, locale
    ko-KR)
    • Flutter version 3.0.2 at /Users/gitsn/Downloads/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision cd41fdd495 (9 days ago), 2022-06-08 09:52:13 -0700
    • Engine revision f15f824b57
    • Dart version 2.17.3
    • DevTools version 2.12.2

 

 

 

 

 

 

 

cocoapods 설치

sudo gem install cocoapods
testpc1@GitsnuicBookAir ~ % sudo gem install cocoapods
Password:(맥북 로그인 패스워드 입력)
Fetching concurrent-ruby-1.1.10.gem
Fetching i18n-1.10.0.gem
Fetching tzinfo-2.0.4.gem
Fetching zeitwerk-2.6.0.gem
Fetching activesupport-6.1.6.gem
Fetching fuzzy_match-2.0.4.gem

...

Parsing documentation for gh_inspector-1.1.3
Installing ri documentation for gh_inspector-1.1.3
Parsing documentation for ruby-macho-2.5.1
Installing ri documentation for ruby-macho-2.5.1
Parsing documentation for cocoapods-1.11.3
Installing ri documentation for cocoapods-1.11.3
Done installing documentation for concurrent-ruby, i18n, tzinfo, zeitwerk, activesupport, 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 19 seconds
34 gems installed
testpc1@GitsnuicBookAir ~ %

 

 

 

 

The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
[✓] Flutter (Channel stable, 3.0.2, on macOS 12.4 21F79 darwin-arm, locale
    ko-KR)
    • Flutter version 3.0.2 at /Users/gitsn/Downloads/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision cd41fdd495 (9 days ago), 2022-06-08 09:52:13 -0700
    • Engine revision f15f824b57
    • Dart version 2.17.3
    • DevTools version 2.12.2

[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/gitsn/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /usr/bin/java
    ✗ Could not determine java version

[!] 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 version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio
    • Android Studio at /Volumes/Android Studio - Chipmunk | 2021.2.1 Patch
      1/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Android Studio not found at /Volumes/Android Studio - Chipmunk | 2021.2.1
      Patch 1/Contents
    • Try updating or re-installing Android Studio.

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 12.4 21F79 darwin-arm
    • Chrome (web)    • chrome • web-javascript • Google Chrome 102.0.5005.115

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 3 categories.

이제 거의 설치가 다되어 간다.

설치하는데 하루종일 걸렸다...."아이고" 소리가 절로나옴...

 

 

 

 

 

윈도우에서 기존소스코드 백업해놓은것 실행

flutter run

하니, 패키지들 설치하면서 뭔가 되다가, 에러남....

Exception: Error running pod install

 

sudo arch -x86_64 gem install ffi     명령

맥북 로그인 패스워드

sudo arch -x86_64 gem install ffi
Password:
Building native extensions. This could take a while...
Successfully installed ffi-1.15.5
Parsing documentation for ffi-1.15.5
Done installing documentation for ffi after 3 seconds
1 gem installed
flutter run
Exception: Error running pod install

ios/Podfile  파일 열어서

# platform :ios, '9.0'  을

# platform :ios, '11.0'  으로 변경

 

ios폴더에서

sudo arch -x86_64 gem install ffi
arch -x86_64 pod install
flutter run
Exception: Error running pod install

해결이 안됨....

 

안드로이드 스튜디오에서 프로젝트 열어서 하니,

ios호환 안되는 모듈 1개를 pubspec.yaml에서 제거후, 정상 동작함.

 

 

 

아이폰에서 실행중인 앱 닫기

맨아래 홈버튼을 쿡쿡 눌러서 실행중인 앱을 손가락으로 위로 밀어버리면 된다.

 

 

앱 다운로드(설치/디버깅)

아이폰 앱 만들었는데, 아이폰에 동작테스트, 설치를 못한다.

왜냐면, 케이블이 없어서...

이런 케이블이 있어야할듯....(참...가지가지 한다...)

 

스마트폰 멀티 케이블 4in1 (IH293), 컴스, 1810229 - 나비엠알오

특징 60W 스마트폰 멀티 케이블(4 in 1) USB 꼬리물기 케이블 C/8핀(8Pin) to PD C/USB 고속충전 및 데이터 전송 내구성이 뛰어난 나일론 소재의 케이블... / No.1 기업 전용 쇼핑몰 나비엠알오(NAVIMRO)입니다.

www.navimro.com

이것보다는 USBC-HDMI 사서, USB 라이트닝 케이블 쓰는게 저렴하고, 포트도 2개밖에 안되서 USBC-HDMI 사는게 좋음.

반응형

'Flutter' 카테고리의 다른 글

flutter - SecureSocket  (0) 2022.06.24
flutter err  (0) 2022.06.24
flutter에서 StatelessWidget 화면 갱신  (0) 2022.05.31
flutter Dart - 포인터? 전역 함수에서 UI 제어하기  (0) 2022.04.07
flutter : Scaffold - 넌 뭐냐?  (0) 2022.04.06
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함