flutter开发中一直Running Gradle task ‘assembleDebug‘...的解决办法
·
进入到项目的android里的build.gradle中修改配置:
google()
mavenCentral()
改为:
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven {
allowInsecureProtocol = true
url 'https://maven.aliyun.com/nexus/content/groups/public'
}
google()
mavenCentral()
这样的修改有二处。allprojects里的repositories也进行相应的修改:
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven {
allowInsecureProtocol = true
url 'https://maven.aliyun.com/nexus/content/groups/public'
}
google()
mavenCentral()
这里是我的整个配置:
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven {
allowInsecureProtocol = true
url 'https://maven.aliyun.com/nexus/content/groups/public'
}
google()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven {
allowInsecureProtocol = true
url 'https://maven.aliyun.com/nexus/content/groups/public'
}
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
在android/gradle/wrapper中的gradle-wrapper.properties进行修改:distributionUrl改为tencent的
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-8.0-bin.zip
更多推荐


所有评论(0)