首先参照官方文档进行搭建Mac下的环境 ,然后就会遇到以下问题: 1.在下载了Flutter 之后,执行Flutter doctor之后,报错:
Could not resolve URL “https://pub.flutter-io.cn”.
Unable to ‘pub upgrade’ flutter tool
解决方法: 重新打开终端:执行以下设置 export PUB_HOSTED_URL=https://pub.flutter-io.cn export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn export PATH=”$PWD/flutter/bin:$PATH” 2.执行之后报错:
Android sdkmanager tool not found
(/Users/zhinengpingtai/Documents/AndroidTools/android-sdk-macosx/tools/bin/sdkma
nager).
Try re-installing or updating your Android SDK,
visit https://flutter.io/setup/#android-setup for detailed instructions.
解决方法:通过Android studio的自带的SDK 管理工具,升级Android Emulator
3.在之后执行flutter doctor会提示一些
Some Android licenses not accepted. To resolve this, run: flutter doctor
–android-licenses
按他们的建议直接执行 flutter doctor –android-licenses
4.运行Android Studio的Flutter的例子 ,无法使用热加载, AS报错:
Error waiting for a debug connection: ProcessException: adb did not report forwarded port
解决方法:直接更新SDK Platform-Tools 即可。
5.运行iOS的时候,执行flutter run 报错:
Cannot find “xcodebuild”. Xcode 9.0 or greater is required to develop for iOS.
Could not build the precompiled application for the device.
解决方法:可能需要更新XCode
6.通过直接在XCODE里面运行会报错:
Xcode will continue when iPhone is connected.
解决方法:XCode的版本太低,升级XCode版本或者使用低版本的iOS进行验证。