赞
踩
Windows11
Java11
下载地址:
https://docs.flutter.dev/get-started/install/windows
我下载的Flutter版本:
将下载的Flutter路径添加到系统环境变量Path中:
path-to-flutter/flutter/bin
Windows Version (Unable to confirm if installed Windows version is 10 or greater)
# 切换flutter渠道
[1] 打开cmd
[2] 输入flutter channel 查看自己的flutter channel版本
[3] 输入flutter channel master,将flutter版本切换为master
[4] 输入flutter upgrade 确保flutter更新到了最新版本
[5] 输入 flutter doctor 再次检查是否解决
Visual Studio not installed; this is necessary for Windows development
下载Visual Studio,地址为:
https://visualstudio.microsoft.com/zh-hans/downloads/
下载完了之后进行安装,我选择了c++模块、和windows 10 SDK。
Android toolchain - develop for Android devices
[1] 下载Android Studio,地址为:
https://developer.android.com/studio/index.html
[2] 通过 Android Studio 设置中的 SDK Tools 来安装 Command-line Tools(lastest)
[3] flutter config --android-sdk E:\environment\Android\Sdk
[4] flutter doctor --android-licenses
[!] Network resources
HTTP Host Availability
X A network error occurred while checking "https://pub.dev/": 信号灯超时时间已到
X An HTTP error occurred while checking "https://github.com/": 信号灯超时时间已到
错误提示如下,分析可知是 maven.google.com 访问失败造成的:
HTTP host https://maven.google.com/ is not reachable. Reason: An error occurred while checking the HTTP host: Operation timed out
[1] 打开path-to-flutter-sdk/packages/flutter_tools/lib/src/http_host_validator.dart文件,修改https://maven.google.com/为 google maven 的国内镜像,如https://dl.google.com/dl/android/maven2/
[2] 设置系统环境变量
FLUTTER_STORAGE_BASE_URL -> https://storage.flutter-io.cn
PUB_HOSTED_URL -> https://pub.flutter-io.cn
[3] 去到flutter\bin\cache目录,删除flutter_tools.snapshot文件。请不要删除cache文件夹,不然需要下载很多东西。
[4] 重新执行flutter doctor
flutter\packages\flutter_tools\gradle\flutter.gradle
原来:
private static final String DEFAULT_MAVEN_HOST = "https://storage.googleapis.com";
修改:
// private static final String DEFAULT_MAVEN_HOST = "https://storage.googleapis.com";
private static final String DEFAULT_MAVEN_HOST = "https://storage.flutter-io.cn";
buildscript { ext.kotlin_version = '1.7.10' repositories { // google() // mavenCentral() maven { allowInsecureProtocol = true url 'http://maven.aliyun.com/nexus/content/repositories/google' } maven { allowInsecureProtocol = true url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' } maven { allowInsecureProtocol = true url 'http://maven.aliyun.com/nexus/content/groups/public/' } } dependencies { classpath 'com.android.tools.build:gradle:7.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } allprojects { repositories { // google() // mavenCentral() maven { allowInsecureProtocol = true url 'http://maven.aliyun.com/nexus/content/repositories/google' } maven { allowInsecureProtocol = true url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' } maven { allowInsecureProtocol = true url 'http://maven.aliyun.com/nexus/content/groups/public/' } } } rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(':app') } tasks.register("clean", Delete) { delete rootProject.buildDir }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。