Created at : 2025-01-15 09:14
Auther: Soo.Y


๐Ÿ“๋ฉ”๋ชจ

How to install Flutter

In Windows, you can use choco.

You donโ€™t need to install SDK. Just use choco.

Enter the this site : chocolatey install docs You can read all of steps.

Install Chocolatey for Individual Use

  1. Open the power shell in administative.
  2. Get-ExecutionPolicy
  3. If Restricted then Set-ExecutionPolicy AllSigned
  4. run below :
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Finally, you can install flutter

choco install flutter

If you want upgrade Dark or Fluter, you can command this.

choco upgrade flutter
choco upgrade dart-sdk

Ref. you can find packages. https://community.chocolatey.org/packages

Thereโ€™s one more thing to check using flutter doctor

flutter doctor can check if it is an environment where the fultter can be developed.

If the following error occurs, additional setting is required.

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.

Android toolchain - develop for Android devices

You need to install those below in Android Studio : Android SDK Command-line Tools (latest) Android SDK Tools (Obsolete)

then,

flutter doctor --android-licenses

Enter and all of โ€œYesโ€.

Finish.

issue 1

๊ด€๋ฆฌ์ž ๊ถŒํ•œ์œผ๋กœ ์‹คํ–‰ํ•˜์ง€ ์•Š๊ณ  powershell์—์„œ flutter ์‹คํ–‰ํ•˜๋Š”๋ฐ Error: Unable to find git in your PATH์ด๋ผ๋Š” ์—๋Ÿฌ๊ฐ€ ๊ณ„์† ๋ฐœ์ƒํ•˜๋ฉด git์„ ์ œ๋Œ€๋กœ ์„ค์น˜ํ•˜๋ผ๋Š” ๋œป์œผ๋กœ ์„ค๋ช…ํ•˜๋˜๋ฐ ๋‚˜ ๊ฐ™์€ ๊ฒฝ์šฐ๋Š” git๋„ ์ œ๋Œ€๋กœ ์„ค์น˜๋˜์–ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ „ํ˜€ ๋‹ค๋ฅธ ๋ฌธ์ œ์˜€๋‹ค. ๊ฒฐ๊ตญ ๊ด€๋ฆฌ์ž ๊ถŒํ•œ์œผ๋กœ ์‹คํ–‰ํ•œ powershell์—์„œ ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•ด์ฃผ๋ฉด ๊ทธ ๋‹ค์Œ๋ถ€ํ„ฐ ์ผ๋ฐ˜์ ์ธ powershell์—์„œ๋„ flutter๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋‹ค.

git config --global --add safe.directory '*'

issue 2

Flutter version์ด ๋‚ฎ๋‹ค๊ณ  ํ•˜๋Š” ๊ฒฝ๊ณ ๊ฐ€ ์žˆ๋‹ค. ๊ทธ๋ž˜์„œ Android Studio๋ฅผ ์‹คํ–‰ํ•˜๋ฉด Flutter์™€ ๊ด€๋ จ๋œ ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•˜์ง€ ๋ชปํ•˜๋Š” ์ƒํ™ฉ์ด ๋ฐœ์ƒํ•œ๋‹ค. ์ด๋ฅผ ํ•ด๊ฒฐํ•˜๋ ค๋ฉด Flutter๋ฅผ ์ตœ์‹  ๋ฒ„์ „์œผ๋กœ ์—…๊ทธ๋ ˆ์ด๋“œ ํ•˜๋ฉด ๋œ๋‹ค. ๋ช…๋ น์–ด๋Š” ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

flutter upgrade

issue 3

์•ˆ๋“œ๋กœ์ด๋“œ๋กœ ๊ฐœ๋ฐœํ•œ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์‹คํ–‰ํ•˜๋ฉด ๊ณ„์† ๋นŒ๋“œ๊ฐ€ ์•ˆ๋˜๋Š” ์—๋Ÿฌ๊ฐ€ ๋‚˜์™”๋‹ค. ์ด๋Ÿด ๋•Œ ๋‚˜์˜ ๊ฒฝ์šฐ๋Š” gradle ๋ฒ„์ „๊ณผ jdk ๋ฒ„์ „์ด ์„œ๋กœ ํ˜ธํ™˜์ด ์•ˆ๋˜์–ด์„œ ๋ฐœ์ƒํ•œ ์—๋Ÿฌ์ด๋‹ค. ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ด์„œ Incompatible ์ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜์ž

flutter analyze --suggestions

Incompatiable ์ด ์žˆ๋‹ค๋ฉด gradle ๋ฒ„์ „์— ๋งž์ถ”์–ด์„œ java jdk ๋ฒ„์ „์„ ์„ค์ •ํ•ด์ฃผ๋ฉด ๋œ๋‹ค.

์œˆ๋„์šฐ ์œ ์ €๋ผ์„œ choco ๋ฅผ ์‚ฌ์šฉํ•ด์„œ openjdk๋ฅผ ์„ค์น˜ํ•˜๊ณ  ๊ฒฝ๋กœ๋„ ์„ค์ •ํ•˜๋ฉด ๋ ๋“ฏํ•ด์„œ ์‹œ๋„ํ•ด๋ณด์•˜๋‹ค.

issue 4์„ ์ฐธ๊ณ ํ•˜๊ธฐ! ๊ฒฐ๊ตญ ํ•ด๊ฒฐํ•จ

issue 4

[Notice] ย 

์•ˆ๋“œ๋กœ์ด๋“œ ์ŠคํŠœ๋””์˜ค๋ฅผ ์„ค์น˜ํ•˜๋ฉด JDK์™€ gradle์€ ์ž๋™์œผ๋กœ ๋‚ด์žฅ๋œ ๋ฒ„์ „์œผ๋กœ ์„ค์น˜๋œ๋‹ค. ๊ตณ์ด ๋ฏธ๋ฆฌ JDK์™€ gradle์„ ๋ฏธ๋ฆฌ ์„ค์น˜ํ•  ํ•„์š”๊ฐ€ ์—†๋‹ค. ํ˜น์‹œ ์‚ฌ์ „์— ์„ค์น˜ํ•œ ๋ฒ„์ „ ๋•Œ๋ฌธ์— ๋ฌธ์ œ๊ฐ€ ๋œ๋‹ค๋ฉด ์•„๋ž˜ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์ด ๋„์›€์ด ๋  ์ˆ˜๊ฐ€ ์žˆ๋‹ค.

[์ด์Šˆ ๋‚ด์šฉ] JDK ๋ฒ„์ „๊ณผ gradle ๋ฒ„์ „ ์ด์Šˆ์ด๊ณ  flutter์—์„œ ๊ฒฝ๋กœ ์„ค์ •์— ๋ฌธ์ œ๊ฐ€ ์žˆ์–ด์„œ ํ•ด๊ฒฐํ•œ ๋‚ด์šฉ์ด๋‹ค.

ํ˜„์žฌ ์•ˆ๋“œ๋กœ์ด๋“œ ์ŠคํŠœ๋””์˜ค ๋ฒ„์ „ 2024.1.12์„ ๊ธฐ์ค€์œผ๋กœ๋Š” gradle์ด 8.3์œผ๋กœ ์„ค์น˜๋œ๋‹ค. ๋‚˜๋Š” ์—ฌ๊ธฐ์„œ flutter jdk ๊ฒฝ๋กœ๋ฅผ ์‚ฌ์ „์— ์ž…๋ ฅํ•ด ๋ฒ„๋ ค์„œ jdk ๋ฒ„์ „์„ ์ฐพ์•„ ๋ณผ ์ˆ˜ ์—†์—ˆ๋‹ค.

JDK๋Š” OpenJDK๋„ ์žˆ์œผ๋‚˜, ์•„๋งˆ์กด์—์„œ ์ œ๊ณตํ•˜๋Š” JDK๋กœ ์„ค์น˜ํ–ˆ๋‹ค. (๋‚œ OpenJDK๋„ ์‹œ๋„ํ–ˆ์œผ๋‚˜, ์•ˆ๋˜์–ด์„œ ๋ฐ”๊ฟ”๋ณธ ์ผ€์ด์Šค์ด๋‹ค.)

gradle 8.3์—๋Š” JDK 17์ด ์ ํ•ฉํ•˜๋‹ค๊ณ  flutter ๊ณต์‹ ์‚ฌ์ดํŠธ์—์„œ ๋ณธ ๊ฒƒ์„ ๊ธฐ๋ฐ˜์œผ๋กœ ์„ค์น˜ํ•˜์˜€๋‹ค.(๊ทธ์ „์—๋Š” JDK 22์ด์˜€๋Š”๋ฐ ์ด๊ฒŒ ๋ฌธ์ œ์˜€๋˜๊ฑฐ ๊ฐ™๋‹ค.)

choco install corretto17jdk

๋งŒ์•ฝ JDK ๊ฒฝ๋กœ๊ฐ€ ์ž๋™์œผ๋กœ ์„ค์ •์ด ์•ˆ๋˜์–ด์„œ ๋ชป ์ฐพ๋Š”๋‹ค๋ฉด flutter config --list์„ ์‚ฌ์šฉํ•ด์„œ ๊ฒฝ๋กœ๋ฅผ ํ™•์ธํ•˜๊ณ  ์„ค์ •์ด ์•ˆ๋˜์–ด ์žˆ๋‹ค๋ฉด flutter config --jdk-dir์„ ์‚ฌ์šฉํ•ด์„œ ์„ค์ •ํ•˜๋ฉด ๋œ๋‹ค.

# ๊ฒฝ๋กœ ์ฐพ๊ธฐ
flutter config --list
# ๊ฒฝ๋กœ ์„ค์ •
flutter cofing --jdk-dir="JDK ๊ฒฝ๋กœ"

๋‚˜๋Š” JDK 17(์•„๋งˆ์กด) + gradle 8.3 + Android studio 2024.1.12 ์กฐํ•ฉ์œผ๋กœ ์„ค์น˜์— ์„ฑ๊ณตํ–ˆ๋‹ค.

์ž˜ ๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋ฐฉ๋ฒ•์€ Android studio์—์„œ ์—๋ฎฌ๋ ˆ์ดํ„ฐ(web ์ œ์™ธ)๋ฅผ ์‹คํ–‰ํ•ด๋ด์„œ ์ •์ƒ์ ์œผ๋กœ ์‹คํ–‰์ด ๋˜๋Š”์ง€ ํ™•์ธํ•ด๋ณด๋ฉด ๋œ๋‹ค.


๐Ÿ“œ์ถœ์ฒ˜(์ฐธ๊ณ  ๋ฌธํ—Œ)

Ref. link Start building Flutter Android apps on Windows

stackoverflow issue


๐Ÿ”—์—ฐ๊ฒฐ ๋ฌธ์„œ