码迷,mamicode.com
首页 > 其他好文 > 详细

Flutter环境变量配置

时间:2019-07-16 10:31:32      阅读:95      评论:0      收藏:0      [点我收藏+]

标签:art   cos   命令   依赖   效果图   hosted   idea   UNC   not   

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;

配置模拟器

成功的标志

技术图片


3.创建新项目

技术图片

技术图片

技术图片

技术图片

Run the app
技术图片

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

效果图:

Android

技术图片

iOS

技术图片

运行在所有可用设备

flutter run -d all

Flutter环境变量配置

标签:art   cos   命令   依赖   效果图   hosted   idea   UNC   not   

原文地址:https://www.cnblogs.com/StevenHuSir/p/Flutter-huan-jing-bian-liang-pei-zhi.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!