美文网首页
Mac环境下安装Flutter

Mac环境下安装Flutter

作者: 依米米一 | 来源:发表于2020-04-20 18:03 被阅读0次

Flutter中文网:https://flutter.io/sdk-archive/#macos

1、下载sdk(Xcode之前就已经下载)

       1)Flutter下载并解压缩 

             Flutter官方下载地址:https://flutter.dev/docs/development/tools/sdk/releases?tab=macos   (我下的是Beta里最新的那个)

       2)Android SDK下载并安装 

          下载地址:https://developer.android.google.cn/studio/

2、配 .bash_profile

打开命令行:

cd ~/

open .bash_profile

如没有.bash_profile文件 则输入

cd ~/

touch .bash_profile

vi .bash_profile

在文件中输入

export PUB_HOSTED_URL=https://pub.flutter-io.cn

export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

export ANDROID_HOME="安卓SDK全路径"

export PATH=${PATH}:${ANDROID_HOME}/tools

export PATH=${PATH}:${ANDROID_HOME}/platform-tools

export PATH=$PATH:flutter bin全路径

图中1为flutter环境变量,2是安卓sdk的环境变量配置,3为flutter bin全路径

command+s保存关闭文件

source .bash_profile

flutter doctor

3、Android license status unknown.

终端输入:flutter doctor --android-licenses

                 一直y直到结束

4、问题解决:flutter sdkmanager tool not found 

                       在andrioid studio下载 sdkmanager tool

下载完finish

下载manager:

下载地址

https://developer.android.google.cn/studio/

把下载的包放到flutter文件夹中

执行命令:flutter doctor

5、  Flutter plugin not installed; this adds Flutter specific functionality.

    Dart plugin not installed; this adds Dart specific functionality.

    在andrioid studio中找到Flutter和Dart安装 install

执行命令:flutter doctor

6、IntelliJ IDEA Community Edition (version 2017.1.4)

    Flutter plugin not installed; this adds Flutter specific functionality.

    Dart plugin not installed; this adds Dart specific functionality.

下载 vscode  直接百度搜索Visual Studio Code mac版下载

打开安装

执行命令:flutter doctor

7、 ! No devices available

打开Xcode 在随便运行个项目,让模拟器跑起来

执行命令:flutter doctor

8、zsh: command not found: flutter  ,no devices

open .bash_profile

加入

export PATH=flutter路劲/flutter/bin:$PATH (比如export PATH=/Users/zxx/Downloads/flutter/bin:$PATH)

command+s保存关闭文件

source .bash_profile

flutter config --android-sdk androidSDK路劲(如:flutter config --android-sdk /Users/ssss/Library/Android/sdk)

flutter doctor

9、创建第一个Flutter项目(我用的Android Studio

打开Android Studio

安装完成后,启动android studio

看到在启动页已经有了创建flutter项目

创建一个flutter项目(需要等待一会)点击“Start a new Flutter project”:

New Flutter Project

到这基本上算是OK了,继续Next,创建项目成功后:

Flutter项目界面

1.Android 文件夹为Android原生交互代码

2、模拟器

3.iOS文件夹为iOS原生交互代码

5.lib文件夹为flutter代码,既我们需要编写的dart代码

6、运行

OK啦

相关文章

网友评论

      本文标题:Mac环境下安装Flutter

      本文链接:https://www.haomeiwen.com/subject/dxmyvhtx.html