Hướng dẫn cài đặt Flutter trên MacOS 2021

Hướng dẫn cài đặt Flutter trên MacOS 2021

Các bạn chú ý để cài flutter cho hệ điều hành macos thì bạn cần có cấu hình máy ít nhất là Dung lượng đĩa: 2,8 GB

Yêu cầu hệ thống

để cài flutter cho hệ điều hành macos thì bạn cần có cấu hình máy ít nhất là Dung lượng đĩa: 2,8 GB (không bao gồm dung lượng đĩa cho IDE / công cụ). 

cần dùng git.

Tải xuống Flutter SDK

tải bảninstallation

tải bản installation ổn định mới nhất của đầu năm 2021: 

bấm vào đây để download flutter

Giải nén

Giải nén file cài vào 1 chỗ quái nào đó: 

ví dụ: ~/development

cd ~/development
unzip ~/Downloads/flutter_macos_1.22.6-stable.zip

Terminal

dĩ nhiên nếu không muốn gặp lỗi thì bạn phải tạo folder development tương ứng với đường dẫn ~/development đã nha.

thiết lập path hệ thống cho flutter

export PATH="$PATH:`pwd`/flutter/bin"

Terminal

Lệnh trên chỉ tạo path cho terminal hiện tại tạm thời thôi. nghĩa là shutdown máy là path đó biến mất. nếu muốn nó không mất thì update nó vào ~/.bash_profile nha. Bạn muốn hiểu thêm thì bạn xem bài này : cách config biến môi trường trong macos hoặc cụ thể bạn muốn thêm biến môi trường cho flutter mãi bạn xem config này: cách config biến môi trường flutter trong macos

Kiểm tra cài đặt Flutter còn thiếu những gì

sau khi cài đặt path rồi thì flutter sẽ cung cấp cho bạn 1 trình kiểm tra những thứ còn thiếu để run được flutter. bạn chỉ cần gọi lệnh sau để biết quá trình cài đặt cần thêm những gì: 

flutter doctor

Terminal

nó chạy ra 1 nùi lỗi thì gặp lỗi nào fix lỗi đó nha. 

ví dụ lỗi này: 

Chưa chấp nhận điều khoản

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)

    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

 thì chỉ cần chạy: 

flutter doctor --android-licenses

Terminal

Thiếu Xcode

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:

        sudo gem install cocoapods

Chưa thêm plugin flutter trong android studio

Flutter plugin not installed; this adds Flutter specific functionality.

     Dart plugin not installed; this adds Dart specific functionality.

Bạn vào android studio thêm plugin Flutter vào là nó sẽ hết lỗi này

Chưa thêm plugin flutter cho vscode

Flutter extension not installed; install from

      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

tương tự là vscode cũng muốn bạn thêm extention Flutter

 


Tags

admin

Hãy chia sẽ cảm nghĩ của bạn về bài viết trên nhé !

 Tải hệ điều hành Windows 7 Ultimate 32/64Bit link Google Drive Đọc tin kế

Tải hệ điều hành Windows 7 Ultimate 32/64Bit link Google Drive

0 Nhận xét

  • Hãy trở thành người đầu tiên viết chia sẽ cảm nghĩ của mình bên dưới nhé!

Thêm Bình luận