在AndroidStudio中搭建Flutter开发环境


安装 Flutter 和 Dart 插件

安装步骤:

  1. 打开Android Studio
  2. 选择Android Studio,选择Preferences,选择Plugins
  3. 选择Browse repositories,搜索Flutter,选择安装
  4. 弹出安装Dart 插件对话框时,选择安装
  5. 重启Android Studio

获取Flutter SDK

1.可以去flutter官网下载其最新可用的安装包 。
在这里插入图片描述
也可以去Flutter GitHub项目下去下载安装包
在这里插入图片描述
2. 解压下载的flutter_macos_v1.2.1-stable.zip文件,然后配置环境变量:

1.open ~/.bash_profile
2.添加:export PATH={你存储的路径}/flutter/bin:$PATH,例如:export PATH=/Users/admin/project/flutter/flutter/bin:$PATH
3.source ~/.bash_profile

3.查看是否安装成功

运行flutter doctor 命令:

admindeMacBook-Pro-88:~ admin$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.1 18B75, locale zh-Hans-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[✗] iOS toolchain - develop for iOS devices
    ✗ 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
    ✗ libimobiledevice and ideviceinstaller are not installed. To install with Brew, run:
        brew update
        brew install --HEAD usbmuxd
        brew link usbmuxd
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    ✗ ios-deploy not installed. To install:
        brew install ios-deploy
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
        For more info, see https://flutter.io/platform-plugins
      To install:
        brew install cocoapods
        pod setup
[!] Android Studio (not installed)
[✓] Connected device (1 available)

创建Flutter App

1.在Android Studio 中,点击File → New → New Flutter Project

2.选择New Flutter Application,点击Next
在这里插入图片描述
Flutter SDK path选择之前解压下载的flutter_macos_v1.2.1-stable.zip文件的路径

3.创建项目成功后,直接run main.dart

在这里插入图片描述
初次run时间稍微长。

在手机上的运行效果:

除了打开时间稍微有点长(大概有两秒)外,页面刷新还是挺流畅的。

Flutter 学习参考资料

1.Flutter 官方网站:英文文档中文文档

2.Flutter 项目GitHub地址:Flutter

3.Flutter 中文网

4.阿里巴巴组织的 Flutter学习项目GitHub地址:flutter-go

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值