环境搭建

2022/11/8 Flutter环境搭建Android StudioSDK

本文介绍Flutter和Android Studio的安装及配置,以及如何配置vscode,并且推荐一些vscode的插件。

# Android Studio 安装

# Android Studio 配置SDK

  • 下载SDK 下载SDK 下载SDK
  • 下载Tools 下载SDK-Tools

# Android Studio 配置虚拟机

  • 配置虚拟机 配置虚拟机

  • 下载镜像 下载镜像

# XCode 安装

  • Mac直接商店下载

# Mac 还需要安装cocoapods

# Fultter SDK安装

  • 官网-Zip (opens new window)
  • 配置环境变量
    • macos
        $ vi ~/.bash_profile
      
      1
    • 写入配置
      
        export FLUTTER_HOME=~/Documents/sdk/flutter
        # flutter sdk 看好自己flutter文件夹的路径
        export PATH=${PATH}:${FLUTTER_HOME}/bin
        # dart sdk
        export PATH=${PATH}:${FLUTTER_HOME}/bin/cache/dart-sdk/bin
      
        # flutter-io 国内镜像
        export PUB_HOSTED_URL=https://pub.flutter-io.cn
        export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
      
        # android SDK路径(一般默认都在这)
        export ANDROID_HOME=~/Library/Android/sdk
        export PATH=${PATH}:${ANDROID_HOME}/platform-tools
        export PATH=${PATH}:${ANDROID_HOME}/tools
      
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
    • 生效配置
        $ source ~/.bash_profile
      
      1
    • 检查
        $ flutter doctor
      
      1

# VScode 插件安装

  • Flutter
  • Awesome Flutter Snippets
  • Flutter Widget Snippets

# VScode创建项目

  • cmd+shift+p 输入 flutter new project
  • 选择Application

# cli方式创建

  • flutter create flutter_quickstart_learn
    
    1

# 常见问题

  • 同意Android Licenses
      flutter doctor --android-licenses
    
    1
最后更新时间: 2022/11/29 07:33:47