很多大牛说更改maven仓为国内源是对的,没毛病,可能因为网速问题我等了1个多小时后成功
文档中心https://developer.huawei.com/consumer/cn/doc/hiai-Guides/config-maven-0000001050040031
pluginManagement {
repositories {
maven{ url = "https://maven.aliyun.com/repository/public" }
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven{ url = "https://maven.aliyun.com/repository/public/" }
google()
mavenCentral()
}
}
rootProject.name = "My Application"
include ':app'
经过耐心等待后,成功编译,要下载很长时间
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
// 配置HMS Core SDK的Maven仓地址。
maven {url 'https://developer.huawei.com/repo/'}
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
gradlePluginPortal()
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
// 配置HMS Core SDK的Maven仓地址。
maven {url 'https://developer.huawei.com/repo/'}
}
}
rootProject.name = "Hhs"
include ':app'
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
//华为仓库
maven { url 'https://developer.huawei.com/repo/' }
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
//华为仓库
classpath 'com.huawei.agconnect:agcp:1.5.2.300'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}