一、flutter安装与配置
1.下载macOS版本
- flutter地址:https://flutter.io/sdk-archive/#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
- Android Studio下载地址:https://developer.android.google.cn/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' }
网友评论