關注agc-get-started-android并擁有
專案級 build.gradle:
buildscript {
repositories {
google()
mavenCentral()
maven {url 'https://developer.huawei.com/repo/'}
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
classpath 'com.huawei.agconnect:agcp:1.6.0.300'
}
}
應用模塊 build.gradle:
plugins {
id 'com.android.application'
id 'com.huawei.agconnect'
}
...
dependencies {
...
implementation 'com.huawei.hms:location:6.0.0.302'
}
Gradle 構建以以下錯誤結束:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.huawei.hms:location:6.0.0.302.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/huawei/hms/location/6.0.0.302/location-6.0.0.302.pom
- https://repo.maven.apache.org/maven2/com/huawei/hms/location/6.0.0.302/location-6.0.0.302.pom
- https://jcenter.bintray.com/com/huawei/hms/location/6.0.0.302/location-6.0.0.302.pom
Required by:
project :app
我的問題的解決方案是什么?
uj5u.com熱心網友回復:
您可以按照此檔案進行集成。
添加 AppGallery Connect 插件和 Maven 存盤庫。
- 進入buildscript > repositories,配置 HMS Core SDK 的 Maven 倉庫地址。
- 進入allprojects > repositories,配置HMS Core SDK的Maven倉庫地址。
- 如果已將 agconnect-services.json檔案添加到應用程式,請轉到buildscript > dependencies并添加 AppGallery Connect 插件配置。
buildscript {
repositories {
google()
jcenter()
// Configure the Maven repository address for the HMS Core SDK.
maven {url 'https://developer.huawei.com/repo/'}
}
dependencies {
...
// Add the AppGallery Connect plugin configuration. You are advised to use the latest plugin version.
classpath 'com.huawei.agconnect:agcp:1.6.0.300'
}
}
allprojects {
repositories {
google()
jcenter()
// Configure the Maven repository address for the HMS Core SDK.
maven {url 'https://developer.huawei.com/repo/'}
}
}
在 Gradle 7.0 或更高版本中,allprojects > repositories下的配置遷移到專案級settings.gradle檔案。
以下是settings.gradle檔案的配置示例:
dependencyResolutionManagement {
...
repositories {
google()
jcenter()
maven {url 'https://developer.huawei.com/repo/'}
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/355006.html
