美文网首页
初识Flutter

初识Flutter

作者: 程序员的自我救赎 | 来源:发表于2019-08-14 19:07 被阅读0次

    环境搭建(参考网站:https://flutterchina.club

    1、下载Flutter SDK:https://flutter.dev/docs/development/tools/sdk/releases?tab=macos#macos

    进入网站clone:https://github.com/flutter/flutter (有点慢,需要等待)
    

    2、设置全局path

    打开终端:vim ~/.bash_profile
    设置path:
    export PUB_HOSTED_URL=https://pub.flutter-io.cn #国内用户需要设置
    export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn #国内用户需要设置
    export PATH=PATH_TO_FLUTTER_GIT_DIRECTORY/flutter/bin:$PATH
    注意:PATH_TO_FLUTTER_GIT_DIRECTORY 为你flutter的路径,比如“~/document/code”
    export PATH=~/document/code/flutter/bin:$PATH
    重启终端,查看path:echo $PATH
    

    3、检查Flutter运行环境依赖安装

    终端输入:flutter doctor
    出现如下错误:
    
    image.png
    解决办法:下载Android SDK(推荐通过安装Android Studio工具进行SDK下载);
    继续根据错误信息解决即可,最后如下图即可;
    
    image.png

    附录:

    下载Android SDK:https://blog.csdn.net/qq_37443229/article/details/87627385
    下载JDK:https://www.jianshu.com/p/e59f232bbd99
    
    手动设置Android SDK的环境变量:
    export ANDROID_HOME=/Users/gametest/Library/Android/sdk
    export PATH=${PATH}:${ANDROID_HOME}/platform-tools
    export PATH=${PATH}:${ANDROID_HOME}/tools
    export PATH=${PATH}:${ANDROID_HOME}/build-tools/29.0.2
    

    相关文章

      网友评论

          本文标题:初识Flutter

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