美文网首页
Flutter 环境搭建

Flutter 环境搭建

作者: howhyone | 来源:发表于2019-02-22 12:45 被阅读0次

    1 先去下载flutter SDK :SDK下载地址
    2 在终端输入以下指令

    vi $HOME/.bash_profile
    
    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
    

    刷新当前终端窗口,输入下面指令

    source $HOME/.bash_profile 
    

    注意: 如果你使用的是zsh,终端启动时 ~/.bash_profile 将不会被加载,解决办法就是修改 ~/.zshrc ,在其中添加:source ~/.bash_profile
    通过运行flutter/bin命令验证目录是否在已经在PATH中:

    echo $PATH
    

    运行 flutter doctor

    flutter doctor
    

    成功的例子如下图


    成功图片

    常见问题:
    安装flutter 出现的问题;

    iOS toolchain - develop for iOS devices (Xcode 10.0)
    
    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 with Brew:
    
    brew install ios-deploy
    
    Brew can be used to install tools for iOS device development.
    
    Download brew at [https://brew.sh/.](https://brew.sh/.)
    

    解决方案:先 https://brew.sh/. 去这个网址安装指令, 及时可以使用 brew指令了,提示install xcode ,如果已经安装了xcode,只执行那个指令即可,

    brew update
    
    brew install --HEAD usbmuxd
    
    brew link usbmuxd
    
    brew install --HEAD libimobiledevice
    
    brew install ideviceinstaller
    
    brew install ios-deploy
    

    逐步在终端输入这些命令即可

    常见问题:

    dart SDK 版本过低:更新flutter SDKflutterSDK链接

    相关文章

      网友评论

          本文标题:Flutter 环境搭建

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