美文网首页Flutter开发进阶
Flutter开发进阶:环境搭建

Flutter开发进阶:环境搭建

作者: __Null | 来源:发表于2022-02-25 17:25 被阅读0次

一、flutter安装与配置

1.下载macOS版本

2.配置flutter环境

#Flutter 镜像配置
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn 

#Flutter 配置Flutter命令行工具
export FLUTTER=~/Workspace/flutter
export PATH=~/Workspace/flutter/bin:$PATH

检测:

flutter doctor

二、安装安卓环境与配置

1.安装 Android Studio

2.配置安卓环境

export ANDROID_HOME=~/Workspace/android/SDK
export PATH=~/Workspace/android/SDK/tools:$PATH
export PATH=~/Workspace/android/SDK/platform-tools:$PATH

3.安装SDK

Android SDK, Android SDK Command-line Tools, and Android SDK Build-Tools:

  • Android SDK Build-Tools 31
  • Android SDK Platform-Tools
  • Android SDK Tools(Obsolete)

4.安装 flutter + dart插件

三、问题解决

1.解决java bundle 找不到的问题

  • 将应用 Android Studio.app 显示包内容中的 Contents/jre/Contents 内容拷贝到Contents/jre/jdk/Contents中。需要自己简历jdk目录。

2.解决flutter、dart未安装的问题:

  • Flutter plugin not installed; this adds Flutter specific functionality.
  • Dart plugin not installed; this adds Dart specific functionality.

给新目录添加软链接即可


ln -s ~/Library/Application\ Support/Google/AndroidStudio2021.1/plugins ~/Library/Application\ Support/AndroidStudio2021.1

3.HTTP hosthttps://maven.google.com/is not reachable

  • 项⽬ --> Android -->build.gradle ⽂件,修改内容:找到buildscript 和allprojects 将⾥⾯的:
//google()
//mavenCentral()
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
  • ⽂件路径:flutter/packages/flutter_tools/gradle/flutter.gradle,修改内容(加⼊阿⾥镜像):
//google()
//mavenCentral()
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }

相关文章

网友评论

    本文标题:Flutter开发进阶:环境搭建

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