Flutter学习--flutter情况的安装(windows下)
一、安装git情况和node情况,之前就已经安装,不赘述,图上放下版本:https://i-blog.csdnimg.cn/direct/e56fdc1f148b4372a95976ce534a7cb4.png
二、设置JAVA情况(exe文件)Java JDK
下载地点
其他低版本下载地点(所有低版本列表)
这里用的17版,下载地点
https://i-blog.csdnimg.cn/direct/06100d559c824960b6c43d5f90b7369f.png
.exe安装之后设置情况变量:电脑—右键—高级设置—情况变量
1.新建用户情况变量JAVA_HOME,变量值是jdk的地点
https://i-blog.csdnimg.cn/direct/c93823175e3a4fc59835cad8cae744d5.png
2.然后进入用户变量中的Path,点击“编辑”,新建以下path,即“%JAVA_HOME%\bin”,如下图:
https://i-blog.csdnimg.cn/direct/971eb5e92b614471ac777dd458be8637.png
3.测试JDK是否设置乐成,打开powerShell下令 (留意:一定要重新打开,不能用在设置Java情况变量前打开的),然后输入下令“java --version”,如果可以大概乐成显示JDK版本信息,则阐明JDK设置乐成。
https://i-blog.csdnimg.cn/direct/de6c7b063ce849b9aca2b44c1117b3af.png
三、安装flutter
下载flutter SDK 选稳定版本,解压之后放到某个盘,我这里放到D:\program file
设置flutter情况变量
1.电脑—右键—高级设置—情况变量—粘贴下面flutter/bin目次地点
D:\program file\flutter\bin
D:\program file\flutter\bin \cache\dart-sdk
https://i-blog.csdnimg.cn/direct/726e3a07ac03466e99da82e3c7194e11.png
四、设置安卓情况
安卓情况需要安装android studio
Android Studio下载
下载flutter插件:
安装安卓之后—打开—选右下角plugins—输入flutter并搜索—举行安装—重启
五、powerShell下令输入“flutter doctor”下令检察flutter安装情况,报错信息逐个排查解决
https://i-blog.csdnimg.cn/direct/10e639e7df514df59f0dfa8fa7a3eace.png
1.cmdline-tools component is missing
https://i-blog.csdnimg.cn/direct/435277cf9950452ca56f9797b6c9018a.png
打开AndroidStudio右上角设置—》操作下图的勾选项点下载图标--》点OK去下载
https://i-blog.csdnimg.cn/direct/29d3db8e3e684e989a8f686f59bf57a8.png
2.Android license status unknown
https://i-blog.csdnimg.cn/direct/bbc35ecad5864905977ec60fe8a707ac.png
安装证书,下令:flutter doctor --android-licenses(报错信息里有,拷贝实行即可),一步步提示y/n全部选y
3.Visual Studio - develop Windows apps
https://i-blog.csdnimg.cn/direct/52bcc451d7294910b5965588082bd685.png
下载地点
https://i-blog.csdnimg.cn/direct/073cfa635a1f4aef89ecfacabde39f03.png
4.解决Google USB Driver
https://i-blog.csdnimg.cn/direct/260f4733e1b64955ba9acca80a9fcdb0.png
终端实行 flutter devices
https://i-blog.csdnimg.cn/direct/4256659dd4304ef39713ee9a4f5275f4.png
六、安装gradle(依靠仓库,打包工具,需要jdk版本8以上)
Gradle | Releases
下载地点这里用7.5版本,将下载的文件解压到本地目次,如:D:\gradle-7.5
https://i-blog.csdnimg.cn/direct/f10b0b6e03a445cb9908310a6347da9c.png
1.设置情况变量
https://i-blog.csdnimg.cn/direct/e1eb96d02cc74db59542bcb2033681b3.png
https://i-blog.csdnimg.cn/direct/278f28c3e61d4f418b72e5127a1a66b3.png
2.设置打包下载地点变量(下载到D:\gradle,要不然默认给放C盘)
https://i-blog.csdnimg.cn/direct/cf2c437e622641269197b401ebc67a8d.png
七、以上操作完成,现在实行fluttler doctor会报下面的错误
https://i-blog.csdnimg.cn/direct/35c86eda4c1f408da81ce3bb7bc67954.png
1.做个镜像
在D:\gradle(对应上面六-2的信息资源包地点/文件打包下载地点)新建一个文件,名字:init.gradle。
主要功能是将一些默认的Maven仓库替换为阿里云的镜像仓库,以加速依靠的下载速率,内容如下:
allprojects{
repositories {
def ALIYUN_REPOSITORY_URL = 'https://maven.aliyun.com/repository/public'
def ALIYUN_JCENTER_URL = 'https://maven.aliyun.com/repository/public'
def ALIYUN_GOOGLE_URL = 'https://maven.aliyun.com/repository/google'
def ALIYUN_GRADLE_PLUGIN_URL = 'https://maven.aliyun.com/repository/gradle-plugin'
all { ArtifactRepository repo ->
if(repo instanceof MavenArtifactRepository){
def url = repo.url.toString()
if (url.startsWith('https://repo1.maven.org/maven2/')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
remove repo
}
if (url.startsWith('https://jcenter.bintray.com/')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
remove repo
}
if (url.startsWith('https://dl.google.com/dl/android/maven2/')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_GOOGLE_URL."
remove repo
}
if (url.startsWith('https://plugins.gradle.org/m2/')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_GRADLE_PLUGIN_URL."
remove repo
}
}
}
maven { url ALIYUN_REPOSITORY_URL }
maven { url ALIYUN_JCENTER_URL }
maven { url ALIYUN_GOOGLE_URL }
maven { url ALIYUN_GRADLE_PLUGIN_URL }
}
}
代码里的镜像地点都是阿里云的,可参考:阿里云镜像文档,也可以换成其他家的镜像地点
2.实行flutter doctor,会报:无法访问https://maven.google.com
https://i-blog.csdnimg.cn/direct/94066b1dfffb40e09d2572ee270ce09d.png
(1)进入flutter sdk的目次,打开D:\Program Files\flutter\packages\flutter_tools\lib\src \http_host_validator.dart
(2)将https://maven.google.com/修改https://maven.aliyun.com/repository/google/
https://i-blog.csdnimg.cn/direct/5e46860dd07e4bf89c316f2a2efe51f9.png
(3)去到flutter\bin目次,删除 cache 目次下的 flutter_tools.snapshot 文件
3.在cmd下令窗口重新运行flutter doctor此时会报A network error occurred while checking“https://github.com/“
https://i-blog.csdnimg.cn/direct/cc4b74ccf79c45c8bc8573e3357f7b7a.png
将以下全部复制粘贴到C:\Windows\System32\drivers\etc\hosts内里生存之后。
192.30.253.113 github.com
192.30.252.131 github.com
185.31.16.185 github.global.ssl.fastly.net
74.125.237.1 dl-ssl.google.com
173.194.127.200 groups.google.com
192.30.252.131 github.com
185.31.16.185 github.global.ssl.fastly.net
74.125.128.95 ajax.googleapis.com
192.30.255.112 github.com git
185.31.16.184 github.global.ssl.fastly.net
192.30.253.112 github.com
192.30.253.119 gist.github.com
151.101.184.133 assets-cdn.github.com
151.101.184.133 raw.githubusercontent.com
151.101.184.133 gist.githubusercontent.com
151.101.184.133 cloud.githubusercontent.com
151.101.184.133 camo.githubusercontent.com
151.101.184.133 avatars0.githubusercontent.com
151.101.184.133 avatars1.githubusercontent.com
151.101.184.133 avatars2.githubusercontent.com
151.101.184.133 avatars3.githubusercontent.com
151.101.184.133 avatars4.githubusercontent.com
151.101.184.133 avatars5.githubusercontent.com
151.101.184.133 avatars6.githubusercontent.com
151.101.184.133 avatars7.githubusercontent.com
151.101.184.133 avatars8.githubusercontent.com 再次运行flutter doctor。
https://i-blog.csdnimg.cn/direct/39ede42e98c244fea3751aa7fe788bc7.png
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页:
[1]