zoukankan      html  css  js  c++  java
  • Flutter环境变量配置

    Flutter环境变量配置

    1.下载Flutter SDK

    2.配置环境变量

    在当前用户目录下创建.bash_profile文件,如果该文件已经存在,则直接打开.

    打开配置文件

    open -e .bash_profile
    

    配置

    export PUB_HOSTED_URL=https://pub.flutter-io.cn
    export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
    export PATH=/Users/hujintao/flutter/bin:$PATH
    
    export ANDROID_HOME=$HOME/Library/Android/sdk
    export PATH=$PATH:$ANDROID_HOME/tools
    export PATH=$PATH:$ANDROID_HOME/tools/bin
    export PATH=$PATH:$ANDROID_HOME/platform-tools
    
    export PATH=$PATH:$ANDROID_HOME/emulator
    
    export RN=/usr/local/bin
    export PATH=$RN:$PATH
    
    GRADLE_HOME=/Users/Apple/Desktop/soft/gradle/gradle-4.6 
    export GRADLE_HOME
    export PATH=$PATH:$GRADLE_HOME/bin
    
    export NVM_DIR=~/.nvm
    source $(brew --prefix nvm)/nvm.sh
    

    其他问题解决

    终端执行命令flutter doctor 检测安装依赖

    ✗ 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
    [!] Android Studio (version 3.4)
        ✗ Flutter plugin not installed; this adds Flutter specific functionality.
        ✗ Dart plugin not installed; this adds Dart specific functionality.
    [!] IntelliJ IDEA Ultimate Edition (version 2018.1.4)
        ✗ Flutter plugin not installed; this adds Flutter specific functionality.
        ✗ Dart plugin not installed; this adds Dart specific functionality.
    [!] VS Code (version 1.35.1)
        ✗ Flutter extension not installed; install from
          https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
    

    android studio 配置

     解决方案:打开android studio, 打开plugin;
    输入flutter搜索,点击中间的 Search in repositories;
    需要安装两个插件:

    • Flutter插件: 支持Flutter开发工作流 (运行、调试、热重载等).
    • Dart插件: 提供代码分析 (输入代码时进行验证、代码补全等).
      要安装这些:
    • 点击install,安装完毕之后重启android studio;

    配置模拟器

    成功的标志

    成功的标志.jpg


    3.创建新项目

    创建新项目1.jpg

    创建新项目2.jpg

    创建新项目3.jpg

    创建新项目4.jpg

    Run the app
    Run the app.jpg

    //终端下建个文件夹,用命令创建一个flutter项目
    1. flutter create myapp
    //进入项目
    2. cd myapp
    //run起来
    3. flutter run
    

    效果图:

    Android

    Android.jpg

    iOS

    iOS.jpg

    运行在所有可用设备

    flutter run -d all
    
  • 相关阅读:
    VisualVM工具的使用
    jstack的使用
    JVM内存溢出的定位与分析
    初识JVM
    JVM运行参数
    VIM 常用命令
    python3 简单抓取图片2
    python3 抓取图片
    node.js GET 请求简单案例
    node.js 爬虫
  • 原文地址:https://www.cnblogs.com/StevenHuSir/p/Flutter-huan-jing-bian-liang-pei-zhi.html
Copyright © 2011-2022 走看看