Flutter新建项目运行报错Exception in thread "main" java.net.ConnectException: Connection timed out
[删除(380066935@qq.com或微信通知)]
1. 修改flutter目录下\packages\flutter_tools\gradle\flutter.gradle
buildscript {
repositories {
//google()
//jcenter()
//添加aliyun的镜像仓库
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:3.5.0'
}
}
2.1 如果还是提示错误,通过查看android目录下的gradle-wrapper.properties查看版本,通过 Gradle官方下载地址,下载对应的Gradle版本zip文件放到,一般C盘目录下.gradle\wrapper\dists\对应版本目录中。