Flutter 学习笔记 | 环境搭建 |

本人是在Windows 系统上进行学习的,环境搭建还是以Windows 系统为主,以后可能会更新其他系统。

推荐

 Flutter 中文网
 Flutter 中文社区
 Flutter 掘金
 Flutter Packages
 Flutter Showcase
 技术胖 Flutter基础视频 - 免费

Flutter SDK

 SDK下载有两种方式

 方式一,官网下载:Flutter SDK

 方式二:Git下载
  Git 客户端下载:Git - windows
  安装好Git后,输入git clone https://github.com/flutter/flutter.git进行下载。

 SDK下载完毕后,在系统环境变量中的用户变量找到Path变量(没有的话新建一个,也可在系统变量中找),新添一个值为flutter/bin全路径的条目。

Flutter 官方镜像,添加用户变量

变量名:PUB_HOSTED_URL
变量值:https://pub.flutter-io.cn

变量名:FLUTTER_STORAGE_BASE_URL
变量值:https://storage.flutter-io.cn

Flutter IDE

 Android Studio

 IDE下载:Android Studio
 gradle下载地址:Gradle Distributions (AndroidStudio下载Gradle会慢一点,不如自己下载某个版本gradle,然后手动放入目录解压)

IDE Plugins:flutter(主界面 -> configure -> setting -> plugins -> Browse Repositories 搜索flutter)
下载flutter插件的同时会把Dart插件一起下载。

 顺便再在环境变量中添入 Android SDK 系统变量

系统变量:ANDROID_HOME
变量值,例如:D:\android\sdk

Flutter 初运行

 首先,在系统变量的Path中,加入flutter目录bin的全路径。
 然后,打开一个新的命令提示符(可windows + R 输入cmd开启),在命令提示符中输入:

flutter doctor
或
flutter doctor -v

 运行过后会出现以下提示(已经配好):

flutter doctor 结果:
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 6.1.7600], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.3)
[√] IntelliJ IDEA Ultimate Edition (version 2018.3)
[√] Connected device (1 available)

flutter doctor -v 结果:
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 6.1.7600], locale zh-CN)
    • Flutter version 1.2.1 at C:\Users\wzl\Desktop\flutter
    • Framework revision 8661d8aecd (4 weeks ago), 2019-02-14 19:19:53 -0800
    • Engine revision 3757390fa4
    • Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at D:\Android\Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = D:\Android\Sdk
    • Java binary at: D:\Android\AndroudStudio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[√] Android Studio (version 3.3)
    • Android Studio at D:\Android\AndroudStudio
    • Flutter plugin version 33.3.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[√] IntelliJ IDEA Ultimate Edition (version 2018.3)
    • IntelliJ at D:\0_SoftWare\IntelliJ IDEA 2018.2.2
    • Flutter plugin version 31.3.4
    • Dart plugin version 183.4886.3

[√] Connected device (1 available)
    • SM T331C • db73cefe03b5cfd2 • android-arm • Android 4.4.2 (API 19)

 另外会需要用到的命令:

flutter doctor --android-licenses  提示:一直按 y

flutter upgrade  提示:升级flutter

flutter --version  提示:查看flutter版本  运行结果 ↓
  Flutter 1.2.1 • channel stable • https://github.com/flutter/flutter.git
  Framework • revision 8661d8aecd (4 weeks ago) • 2019-02-14 19:19:53 -0800
  Engine • revision 3757390fa4
  Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

flutter create flutter_app  提示:创建一个名为flutter_app的项目

flutter --no-color packages get  提示:package 获取

温馨提示:未完待续...

你可能感兴趣的:(Flutter 学习笔记 | 环境搭建 |)