安装环境
一、相关、jdk、sdk、as(需要安装flutter插件)、并配置环境变量
二、Flutter SDK安装,可以在https://flutter.dev/下载,或者https://github.com/flutter/flutter
flutter/bin添加到环境变量中
三、运行flutter doctor
四、vs安装、vs中flutter插件(其中dart已包含)安装
创建项目
flutter create demo01
,执行速度根据网速,执行过程中需要下载
执行项目
打开项目根目录,flutter run
,执行中p键
显示网格,r键
热加载
如果出现如下错误,gradle问题,删除android目录下gradle目录,再次执行flutter run
,或者用as直接打开android项目通过as构建gradle
* Error running Gradle:
ProcessException: Process "E:\flutterPro\demo1\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
* What went wrong:
Could not initialize class com.google.common.cache.LocalCache
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Command: E:\flutterPro\demo1\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.