我的studio版本是3.3
android studio 找到偏好设置,plugins,查找添加Flutter
添加之后创建项目就简单了:
-
择 File>New Flutter Project,主页面上就有New Flutter Project
-
选择 Flutter application 作为 project 类型, 然后点击 Next
-
输入项目名称 (如 myapp), 然后点击 Next
-
点击 Finish
-
等待Android Studio安装SDK并创建项目.
这里边也会遇到安卓SDK配置的问题
运行
flutter doctor
发现了一个sdk的问题
在AS中查到sdk的地址:
/Users/xxx(你的账户名)/Library/Android/sdk
然后在终端配置了一下:
再根目录下运行vim .bash_profile,点击i编辑,退出时候:wq
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export ANDROID_HOME="/Users/xxx(你的账户名)/Library/Android/sdk"
export PATH=${PATH}:/Users/zack/Documents/flutter/bin/
然后又报证书问题:
运行:
flutter doctor --android-licenses
最后成功:
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.6 18G84,
locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version
28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
[✓] Android Studio (version 3.3)
[✓] VS Code (version 1.41.1)
[!] Connected device
! No devices available