vscode flutter 环境搭建
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vscode flutter 环境搭建相关的知识,希望对你有一定的参考价值。
参考技术A 环境准备阶段:android-studio 版本:android-studio-ide-191.5977832-windows.exe 3.5.2
flutter版本:stable 版本 (完成系统环境变量 path配置)
dart版本:2.12.0 (完成系统环境变量 path配置)
完成相关软件安装。
配置flutter相关SDK及andriod studio路径:
flutter config --android-sdk="C:\Users\Administrator\AppData\Local\Android\Sdk"
flutter config --android-studio-dir="D:\Program Files\Android\Android Studio"
执行flutter doctor运行成功。
夜神模拟器地址:D:\Program Files\Nox\bin (完成系统环境变量 path配置)
andriod SDK tools:C:\Users\Administrator\AppData\Local\Android\Sdk\platform-tools (完成系统环境变量 path配置)
nox_adb.exe connect 127.0.0.1:62001
dart SDK:D:\software\dartsdk-windows-x64-release\dart-sdk\bin
将C:\Users\Administrator\AppData\Local\Android\Sdk\platform-tools 下面adb.exe 复制至D:\Program Files\Nox\bin覆盖
adb.exe,此外重新复制adb.exe命名为nox_adb.exe,替换原有的nox_adb.exe。
cdm 输入nox_adb version 及adb version发现版本一致。
启动野神模拟器,输入adb devices发现虚拟设备,执行flutter devices发现 127.0.0.1:62001 设备。
修改C:\learn_flutter\first_flutter\android\gradle\wrapper\gradle-wrapper.properties
distributionUrl= https://downloads.gradle-dn.com/distributions/gradle-6.7-all.zip
修改C:\learn_flutter\first_flutter\android\build.gradle
buildscript
ext.kotlin_version = '1.3.50'
repositories
// google()
// jcenter()
maven url ' https://maven.aliyun.com/repository/google'
maven url ' https://maven.aliyun.com/repository/jcenter'
maven url ' http://maven.aliyun.com/nexus/content/groups/public'
allprojects
repositories
// google()
// jcenter()
maven url ' https://maven.aliyun.com/repository/google'
maven url ' https://maven.aliyun.com/repository/jcenter'
maven url ' http://maven.aliyun.com/nexus/content/groups/public'
修改:C:\win-flutter\flutter\packages\flutter_tools\gradle\flutter.gradle
buildscript
repositories
// google()
// jcenter()
maven url ' https://maven.aliyun.com/repository/google'
maven url ' https://maven.aliyun.com/repository/jcenter'
maven url ' http://maven.aliyun.com/nexus/content/groups/public'
dependencies
classpath 'com.android.tools.build:gradle:4.1.0'
//private static final String DEFAULT_MAVEN_HOST = " https://storage.googleapis.com ";
private static final String DEFAULT_MAVEN_HOST = " https://storage.flutter-io.cn/download.flutter.io ";
修改:C:\win-flutter\flutter\packages\flutter_tools\gradle\resolve_dependencies.gradle
repositories
google()
jcenter()
maven
//url "$storageUrl/download.flutter.io"
url " http://download.flutter.io "
执行 flutter run启动成功。
环境搭建坑点在于JDK兼容问题以及网络问题。
以上是关于vscode flutter 环境搭建的主要内容,如果未能解决你的问题,请参考以下文章