新建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' }
    }
}
相关推荐
用户20187928316716 小时前
Android黑夜白天模式切换原理分析
android
芦半山16 小时前
「幽灵调用」背后的真相:一个隐藏多年的Android原生Bug
android
卡尔特斯17 小时前
Android Kotlin 项目代理配置【详细步骤(可选)】
android·java·kotlin
ace望世界17 小时前
安卓的ViewModel
android
ace望世界17 小时前
kotlin的委托
android
孤鸿玉18 小时前
Fluter InteractiveViewer 与ScrollView滑动冲突问题解决
flutter
CYRUS_STUDIO19 小时前
一文搞懂 Frida Stalker:对抗 OLLVM 的算法还原利器
android·逆向·llvm
zcychong20 小时前
ArrayMap、SparseArray和HashMap有什么区别?该如何选择?
android·面试
CYRUS_STUDIO20 小时前
Frida Stalker Trace 实战:指令级跟踪与寄存器变化监控全解析
android·逆向
ace望世界1 天前
android的Parcelable
android