flutter set gradle mirror

457 阅读1分钟

android/build.gradle

buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        maven { url 'https://maven.aliyun.com/repository/google'}
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/nexus/content/groups/public'}
        maven { url 'https://dl.google.com/dl/android/maven2/'}
        maven { url 'https://download.flutter.io'}
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        maven { url 'https://maven.aliyun.com/repository/google'}
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/nexus/content/groups/public'}
        maven { url 'https://dl.google.com/dl/android/maven2/'}
    }
}

./Caskroom/flutter/3.3.10/flutter/packages/flutter_tools/gradle/flutter.gradle

buildscript {
    repositories {
        // google()
        // mavenCentral()
         maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }
    }
    dependencies {
        /* When bumping, also update ndkVersion above. */
        classpath 'com.android.tools.build:gradle:4.1.0'
    }
}

android/gradle/wrapper/gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://mirrors.huaweicloud.com/gradle/gradle-7.5-all.zip