Flutter ์ดˆ๊ธฐ์„ธํŒ… (macOS)

2021. 1. 24. 18:57ใ†๐Ÿ“Œ Things

๋ฐ˜์‘ํ˜•

 

Flutter ์Šคํ„ฐ๋””๋ฅผ ์‹œ์ž‘ํ•˜๋ฉฐ Flutter ์„ธํŒ…ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ํฌ์ŠคํŒ… ํ•ด๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

๋งŽ์€ ๋ธ”๋กœ๊ทธ ์ž๋ฃŒ๋“ค์ด ์žˆ์—ˆ์ง€๋งŒ ๊ฐ„๋‹จํ•œ ๊ฒฝ๋กœ ์„ธํŒ…์—์„œ ์•ฝ๊ฐ„ ์• ๋ฅผ ๋จน์—ˆ๋‹ค๋Š”... ์ €๊ฐ™์€ ๋ถ„์ด ์—†๊ธธ ๋ฐ”๋ผ๋ฉฐ ์ž‘์„ฑํ•ด๋ณด์•˜์Šต๋‹ˆ๋‹ค ๐Ÿ˜…๐Ÿ˜…

 

Flutter๋Š” AndoridStudio / vscode / IntelliJ / Xcode ๋“ฑ ๊ฝค ๋งŽ์€ ํ”„๋กœ๊ทธ๋žจ์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์ง€๋งŒ ์ €๋Š” Android๋ฅผ ์ฃผ๋กœ ๋‹ค๋ค˜๊ธฐ ๋•Œ๋ฌธ์— Andorid Studio ์„ธํŒ… / Xcode ์„ธํŒ… ์— ๋Œ€ํ•ด์„œ๋งŒ ์ ์–ด๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค!

 

๐Ÿ“Œ Flutter SDK ์„ค์น˜ํ•˜๊ธฐ

์•„๋ž˜ Flutter ๊ณต์‹ ํŽ˜์ด์ง€์— ๊ฐ€๋ฉด ์šด์˜์ฒด์ œ์— ๋งž๊ฒŒ Flutter SDK๋ฅผ ์„ค์น˜ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์ž์„ธํžˆ ๋‚˜์™€์žˆ์Šต๋‹ˆ๋‹ค.

์ €๋Š” macOS์ด๋ฏ€๋กœ macos ๋ฒ„์ „์˜ SDK๋ฅผ ์„ค์น˜ํ•ด์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค.

 

macOS install

How to install on macOS.

flutter.dev

 

๐Ÿ“Œ Flutter ๊ฒฝ๋กœ ์ถ”๊ฐ€ํ•˜๊ธฐ

๋จผ์ € ๋‹ค์šด๋กœ๋“œ ํด๋”์—์„œ ๋‹ค์šด๋ฐ›์€ zipํŒŒ์ผ์˜ ์••์ถ•์„ ํ’€์–ด์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋‹ค์Œ์— ์ €๋Š” iTerm ์„ ๊ธฐ๋ณธ ํ„ฐ๋ฏธ๋„๋กœ ์‚ฌ์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— iTerm ํ„ฐ๋ฏธ๋„์„ ์—ด์–ด์ฃผ์—ˆ์–ด์š”!

 

 

์•„๋ž˜๋Š” ๊ณต์‹ ํŽ˜์ด์ง€์— ๋‚˜์™€์žˆ๋Š” ๊ฒฝ๋กœ ์„ค์ • ๋ฐฉ๋ฒ•์ธ๋ฐ ์•„๋ž˜ ๋ฐฉ๋ฒ•์€ ํ˜„์žฌ ํ„ฐ๋ฏธ๋„์—์„œ๋งŒ ๊ฒฝ๋กœ๋ฅผ ์„ค์ •ํ•˜๋Š” ๊ฒƒ์ด๋ฏ€๋กœ, 

๋‚˜๋Š” PASS ํ•˜๊ณ  flutter ๊ฒฝ๋กœ๋ฅผ ์˜๊ตฌ์ ์œผ๋กœ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ํƒํ–ˆ๋‹ค.

 

Flutter ๊ฒฝ๋กœ ์˜๊ตฌ์ ์œผ๋กœ ์ถ”๊ฐ€ํ•˜๊ธฐ (macOS๊ธฐ์ค€)

๋งฅ OS ์นดํƒˆ๋ฆฌ๋‚˜๋ถ€ํ„ฐ ํ„ฐ๋ฏธ๋„์ด bash๊ฐ€ ์•„๋‹ˆ๋ผ zsh๋กœ ๋ฐ”๋€Œ์—ˆ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ์ง€๋ชปํ•˜๊ณ  ๊ณ„์† ๋‹ค๋ฅธ ๋ธ”๋กœ๊ทธ ๊ธ€์„ ์ฝ์–ด๋ณด๋ฉฐ ~/.bash_profile ๋งŒ ์ฃผ๊ตฌ์žฅ์ฐฝ ์ณ์„œ ๊ฒฝ๋กœ๋ฅผ ์ถ”๊ฐ€ํ•˜๋ ค๊ณ  ํ–ˆ๋‹ค ํ•˜์ง€๋งŒ ์ด ๋ฐฉ๋ฒ•์ด ์ž˜๋ชป๋˜์—ˆ๋‹ค๋Š” ๋“ฏ "command not found: flutter" ๋ผ๋Š” ์—๋Ÿฌ ๋ฌธ๊ตฌ๊ฐ€ ๋‚˜์˜จ๋‹ค.

 

ํŠนํžˆ ๋‚˜๋Š” iTerm ์ปค์Šคํ…€์„ ํ•œ ์ƒํƒœ๋กœ ํ„ฐ๋ฏธ๋„์„ ์‚ฌ์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— ~/.zshrc ์—๋‹ค๊ฐ€ ๊ฒฝ๋กœ๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์–ด์•ผ ํ–ˆ๋‹ค.

 

vi ~/.zshrc

export PATH=$PATH:~/flutter/bin

์ด๋•Œ ! ์ฃผ์˜ํ•ด์•ผํ•  ์ ์€ $PATH: [ ] <- ์ด์ „์— ์••์ถ•ํ•œ flutter ํŒŒ์ผ์˜ ์œ„์น˜์—ฌ์•ผํ•œ๋‹ค!

 

์œ„์— ๋ฐฉ๋ฒ•์„ ์ž˜ ๋”ฐ๋ผํ•˜์…จ๋‹ค๋ฉด ? ํ„ฐ๋ฏธ๋„์„ source ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์žฌ ์‹œ์ž‘ํ•ด์ค€๋‹ค.

source ~/.zshrc

 

 

๐Ÿ“Œflutter --version ํ™•์ธํ•˜๊ธฐ

flutter --version / flutter doctor ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ๊ฒฝ๋กœ๊ฐ€ ์ œ๋Œ€๋กœ ์„ค์ •๋˜์—ˆ๊ณ , flutter sdk ์„ค์น˜๊ฐ€ ์ œ๋Œ€๋กœ ๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•ด๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค!

flutter --version
flutter doctor


Andorid Studio Flutter ์„ธํŒ…ํ•˜๊ธฐ

์œ„์˜ ๋ฐฉ๋ฒ•์„ ์ž˜ ๋”ฐ๋ผ์˜ค์…จ๋‹ค๋ฉด ์•ˆ๋“œ๋กœ์ด๋“œ ์ŠคํŠœ๋””์˜ค๋กœ Flutter๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์†Œ๊ฐœํ•ด๋“œ๋ฆฌ๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

์ €๋Š” ๊ธฐ์กด์— AndoridStudio๊ฐ€ ์„ค์น˜๋˜์–ด์žˆ์—ˆ๊ธฐ ๋•Œ๋ฌธ์— ์„ค์น˜ ๊ณผ์ •์€ ์ƒ๋žตํ•˜๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

 

๐Ÿ“ŒFlutter Plugin ์„ค์น˜ํ•˜๊ธฐ

flutter ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“œ๋ ค๋ฉด AndoridStudio์—์„œ flutter plugin์„ ์„ค์น˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค!

๋จผ์ € Android Studio๋ฅผ ์ผœ์ฃผ์‹  ๋’ค, Preferences๋ฅผ ์—ด์–ด์ฃผ์„ธ์š”.

๊ทธ ๋‹ค์Œ plugin์„ ์ฐพ์•„ flutter๋ฅผ ๊ฒ€์ƒ‰ํ•˜์—ฌ ์„ค์น˜ํ•œ ํ›„ ์žฌ์‹œ์ž‘ ํ•ด์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค!

 

๐Ÿ“Œ Flutter Project ๋งŒ๋“ค๊ธฐ

์„ค์น˜๊ฐ€ ์ œ๋Œ€๋กœ ์™„๋ฃŒ ๋˜์…จ๋‹ค๋ฉด ์•„๋ž˜์™€ ๊ฐ™์ด Create New Flutter Project๊ฐ€ ์ƒ๊ธฐ๋Š” ๊ฒƒ์„ ๋ณด์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค!

์ด๋•Œ ์œ„์—์„œ flutter ๊ฒฝ๋กœ ์„ค์ •์„ ์ œ๋Œ€๋กœ ์ž˜ ํ•ด์ฃผ์‹œ๊ณ  ์„ค์น˜๋ฅผ ์ž˜ ํ•ด์ฃผ์…จ๋‹ค๋ฉด Flutter SDK path๊ฐ€ ์ž๋™์œผ๋กœ ์ถ”๊ฐ€๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค!

๋งŒ์•ฝ ๋นˆ์นธ์ด๋ผ๋ฉด Flutter SDK ๋ฅผ ๋‹ค์‹œ ์„ค์น˜ํ•ด์ฃผ์…”์•ผ ํ•ฉ๋‹ˆ๋‹ค!

 

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด flutter project๋ฅผ AndroidStudio์—์„œ ์ž‘์—…ํ•˜์‹ค ์ˆ˜ ์žˆ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค!

์˜ˆ์ „์— ์„ค์น˜๋œ Andorid Emulator๋กœ flutter app์„ ์‹คํ–‰์‹œ์ผœ๋ณด์•˜์Šต๋‹ˆ๋‹ค!

 


Xcode Flutter ์„ธํŒ…ํ•˜๊ธฐ

๐Ÿ“Œ Xcode ์„ค์น˜ํ•˜๊ธฐ 

iOS ๋นŒ๋“œ๋ฅผ ํ•˜๊ธฐ์œ„ํ•ด์„œ๋Š” Xcode๋ฅผ ์„ค์น˜ํ•ด์ฃผ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ €๋Š” Xcode ์„ค์น˜ ํ›„ Andorid Studio๋ฅผ ํ†ตํ•ด ๋นŒ๋“œํ•  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค!

Andorid Studio ์—์„œ iOS ๋นŒ๋“œ๊ฐ€ ๊ฐ€๋Šฅํ•œ ์ด์œ ๋Š” ๋‚ด๋ถ€์ ์œผ๋กœ Xcode ๊ธฐ๋Šฅ์„ ์ด์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ๋˜์–ด ์žˆ์–ด์„œ ๋•Œ๋ฌธ์ด์˜ˆ์š” !

์„ค์น˜ ํ›„ Xcode๋ฅผ ์—ด์–ด license ๋™์˜๋ฅผ ํ•ด์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค.

 

๐Ÿ“Œcocoapods ์„ค์น˜ํ•ด์ฃผ๊ธฐ

flutter doctor๋กœ ์„ค์น˜๊ฐ€ ๋ชจ๋‘ ์™„๋ฃŒ๋˜์—ˆ๋Š” ์ง€ ํ™•์ธํ•˜๋ฉด ์•„๋งˆ cocoapods ์„ค์น˜๊ฐ€ ์™„๋ฃŒ๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค ๋ผ๊ณ  ๋œน๋‹ˆ๋‹ค. ํ„ฐ๋ฏธ๋„์— ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด cocoapods๋ฅผ ์„ค์น˜ํ•ด์ฃผ์„ธ์š”.

sudo gem install cocoapods

flutter doctor

 

 

- ๋งŒ์•ฝ ์œ„ ๋ฐฉ๋ฒ• ํ›„์—๋„ "CocoaPods not installed." ๊ฐ€ ๊ณ„์† ๋œฌ๋‹ค๋ฉด ?!

์•„๋ž˜ ๋ฐฉ๋ฒ•์„ ์ด์šฉํ•ด์ฃผ์„ธ์š”!

sudo gem uninstall cocoapods

sudo gem install cocoapods -v 1.7.5

pod setup

sudo get install cocoapods

flutter doctor

 

ํ•„์ž๋Š” macOS ์—…๋ฐ์ดํŠธ๋ฅผ ํ•˜์ง€ ์•Š์•„ ๊ณ„์† cocoapods๋ฅผ ์ตœ์‹  ๋ฒ„์ „์œผ๋กœ ์„ค์น˜ํ•ด์•ผํ•œ๋‹ค๋Š” ์˜ค๋ฅ˜๊ฐ€.......๐Ÿ˜ญ๐Ÿ˜ญ๐Ÿ˜ญ

 

๐Ÿ“ŒAndorid Studio๋กœ flutter iOS ์‹คํ–‰์‹œ์ผœ๋ณด๊ธฐ

์œ„์— ๋ฐฉ๋ฒ•์œผ๋กœ Xcode์™€ cocoapods ๋ฅผ ์„ค์น˜ํ•ด์ฃผ์—ˆ๋‹ค๋ฉด AndoridStudio์—์„œ iOS ๋นŒ๋“œ๋„ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค!

Open iOS Simulator๋ฅผ ๋ˆ„๋ฅธ๋‹ค์Œ ์•ฑ์„ ์‹คํ–‰์‹œ์ผœ์ฃผ์„ธ์š”!

 

๋ฐ˜์‘ํ˜•