新建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' }
    }
}
相关推荐
-SOLO-26 分钟前
解决VMware 显示比例被重置的问题
android
alexhilton1 小时前
探究Android Views、Flutter和Compose如何渲染你的UI
android·kotlin·android jetpack
Lesile4 小时前
Android:Hilt框架入门 · 在ViewUI和ComposeUI下的应用
android·android jetpack
用户423816229074 小时前
Android 16 WebView 页面顶部挖孔/通知栏不能显示UI问题排查
android
weixin_727535625 小时前
Loop 已死,Graph 新生:AI 工作流的范式革命
android·人工智能·rxjava
严同学正在努力6 小时前
从备份到恢复:我用 30 分钟恢复了误删的核心业务表
android·java·数据库·ai
梦想三三6 小时前
LangChain Output Parser 实战:从字符串到结构化数据的完整指南
android·服务器·langchain·github·uv
GitLqr8 小时前
深度拆解 Dart 事件循环:从面试题看清 Microtask 与 Event Queue 的执行顺序
flutter·面试·dart
爱笑鱼8 小时前
Binder(八):远端进程死了,BinderProxy 为什么还能收到通知?
android
Android-Flutter9 小时前
Kotlin 冷流与热流详解
android·kotlin