新建Flutter工程修改配置

由于国内 网络环境原因, 新建 flutter工程的 配置文件需要修改几个地方,
1. gradle-wrapper.properties

问题:Exception in thread "main" java.net.ConnectException: Connection timed out: connect:

解决方法:修改为 国内镜像

复制代码
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-7.6.3-all.zip
2. build.gradle

问题:Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.

或者:

Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'maven(XXX)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols.

解决方法:修改为 国内镜像 ,并且配置信 任该镜像

复制代码
allprojects {
    repositories {
//        google()
//        mavenCentral()
        maven {
            allowInsecureProtocol = true
            url 'https://mirrors.cloud.tencent.com/gradle/'
        }
        maven {
            allowInsecureProtocol = true
            url 'https://mirrors.cloud.tencent.com/nexus/repository/maven-public/'
        }
        maven {
            allowInsecureProtocol = true
            url 'https://maven.aliyun.com/repository/gradle-plugin' }
        maven {
            allowInsecureProtocol = true
            url 'http://maven.aliyun.com/nexus/content/groups/public' }
        maven {
            allowInsecureProtocol = true
            url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
        maven {
            allowInsecureProtocol = true
            url 'https://maven.aliyun.com/repository/jcenter' }
        maven {
            allowInsecureProtocol = true
            url 'https://maven.aliyun.com/repository/google' }
    }
}
相关推荐
小锋学长生活大爆炸几秒前
【工具】在 Android 手机上运行 Docker
android·docker·智能手机
Carson带你学Android10 分钟前
OpenAI Dots 登陆手机端:手机上派任务,AI 在云端写代码
android·ios
事圆则缓16 分钟前
Android 依赖注入库到底应该怎么选
android
大圣编蚕10 小时前
初探 NDK 的世界:从零开始理解 Android 原生开发
android
云贝贝贝10 小时前
MySQL 慢查询定位与索引优化实战
android
骑着蜗牛撵大象32711 小时前
服务下线不再炸:分层关闭、TCP 存活探测与负载均衡排水的落地套路
android·tcp/ip·负载均衡·tcp·高可用·健康检查·优雅关闭
Geek_Vison11 小时前
保险APP已经用了Flutter,还能接入小程序吗?
flutter·小程序·uni-app·mpaas·小程序容器
FungLeo11 小时前
成为全栈·Flutter App 篇·go_router 与四 Tab App Shell:保留导航状态、深链和登录回跳
flutter·移动开发·成为全栈·go_router·路由设计·深链接
m0_7381858212 小时前
Flutter 鸿蒙化实战:screen_protector 适配 OpenHarmony,防截屏/防泄露
flutter·华为·harmonyos·鸿蒙
三少爷的鞋13 小时前
别再这么写协程了!Marcin Moskała 剖析的 几个常见协程误区与重构
android