Mac pro 搭建Flutter 开发环境和第一个Flutter程序

什么是Flutter

Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on iOS and Android in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.

优点

  • 号称是可以一次开发Android和iOS的原生级别的应用,热重新加载 ,表现灵活的用户界面 ,

  • 使用Dart语言编写一套代码即可同时在Android和iOS平台运行,性能无限接近原生,支持android 4.1以上 和 iOS8以上,一般都没有听过Dart 这个语言是什么鬼,但是啊,不要紧张,dart的语言可以说就是Java的语法,so,对于我们Android开发者来说就很容易接受

  • flutter 里面调用了Java和kotlin的类库 ,当然还有swift ,不用开发者在配置一遍

  • 并且flutter的正式版可以实现跨平台

  • -在现有的开发工具中完全支持开发

我们Android开发者直接可以使用Android studio进行开发 很简单

安装Flutter

环境:Mac
开发工具:Android studio 3.1
- 安装Flutter
1. 下载Flutter源码 (官方建议下载beta分支)

git clone -b beta https://github.com/flutter/flutter.git

2.代码下载之后在终端中打开bash_profile文件 进行配置(这个文件用Mac开发过的应该都会有,如果没有,自己创建bash_profile(找度娘))

export PATH=$PATH:XXX/flutter/bin 或者
export PATH="XXX/flutter/bin:$PATH"

这里写图片描述

  1. 然后使用flutter doctor 命令进行安装,几分钟后会显示
[✓] Flutter (Channel beta, v0.1.5, on Mac OS X 10.11.1 15B42, locale zh-Hans)
[✓] Android toolchain - develop for Android devices (Android SDK 26.0.2)
[!] iOS toolchain - develop for iOS devices (Xcode 7.3.1)
    ✗ Flutter requires a minimum Xcode version of 9.0.0.
      Download the latest version or update via the Mac App Store.
    ✗ libimobiledevice and ideviceinstaller are not installed. To install, run:
        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 (version 3.1)
[✓] IntelliJ IDEA Community Edition (version 2017.3.1)
[✓] Connected devices (1 available)
! Doctor found issues in 1 category.

证明就安装成功了

配置Android Studio

下载插件flutter ,在下载的过程中会自动下载dart

这里写图片描述

点击instsll 重启Android studio

新建Flutter项目

点击new –> new Flutter project –> Flutter Application –> 选择Flutter SDK(刚才下载的) –> finish 创建完成

点击运行 :
这里写图片描述

这就完成了Flutter的环境的搭建和创建第一个Flutter程序

后边会在关于Flutter 深度学习的资料

下一篇
Flutter框架基础

我学习的整个过程的项目地址 https://github.com/kongxiaoan/flutter_app

支持原创 转载请注明 图你怀中安稳 https://blog.csdn.net/qq_32648731/article/details/80007499

猜你喜欢

转载自blog.csdn.net/qq_32648731/article/details/80007499