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
- Open the power shell in administative.
Get-ExecutionPolicy
- If
Restricted
thenSet-ExecutionPolicy AllSigned
- 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