注意说明:mac上一定要安装java环境,再配上以下变量,已配置的略过
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home PATH="$JAVA_HOME/bin:$PATH" CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:. export JAVA_HOME export PATH export CLASSPATH
这里是配置安卓环境,已配置的略过
export ANDROID_HOME=/Users/mm/Library/Android/sdk export PATH=${PATH}:${ANDROID_HOME}/tools export PATH=${PATH}:${ANDROID_HOME}/platform-tools
1.按以下配置
1.终端中输入以下指令克隆项目 git clone -b beta https://github.com/flutter/flutter.git (或git clone -b dev https://github.com/flutter/flutter.git)
2. 导出到Flutter保存路径 export PATH=`pwd`/flutter/bin:$PATH
3.export PUB_HOSTED_URL=https://pub.flutter-io.cn
4.export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
5.export PATH="$PWD/flutter/bin:$PATH"
6.cd ./flutter
7.flutter doctor
2.完成第8步会输出以下,表示输出完成
[✓] Flutter (Channel beta, 1.20.2, on Mac OS X 10.15.6 19G2021, locale zh-Hans-CN) [!] Android toolchain - develop for Android devices (Android SDK version 30.0.2) ✗ Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses [!] Xcode - develop for iOS and macOS (Xcode 11.6) ✗ CocoaPods not installed. CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To install: sudo gem install cocoapods [✓] Android Studio (version 3.5) [!] Connected device ! No devices available
4.打开android studio 安装 flutter、dart插件
5.安装完后在终端输入flutter doctor,若报错Android license status unknown ,请看我上一篇文章
6.安装完成后,创建flutter项目
flutter create appname
7.创建完成后进入项目,需要提前打开模拟器
flutter run
8.以下是安卓上的运行效果,由于配置xcode比安卓简单,就不记录了