Home > front end >  Error "Could not find com.huawei.hms:location:6.0.0.302" while adding Huawei Kits
Error "Could not find com.huawei.hms:location:6.0.0.302" while adding Huawei Kits

Time:11-04

Following agc-get-started-android and having

Project level 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'

    }
}

App module build.gradle:

plugins {
    id 'com.android.application'
    id 'com.huawei.agconnect'
}
...
dependencies {
    ...
    implementation 'com.huawei.hms:location:6.0.0.302'
}

Gradle build ends with error below:

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

What is the solution to my problem?

CodePudding user response:

You could follow this docs to integrate.

Add the AppGallery Connect plugin and the Maven repository.

  • Go to buildscript > repositories and configure the Maven repository address for the HMS Core SDK.
  • Go to allprojects > repositories and configure the Maven repository address for the HMS Core SDK.
  • If the agconnect-services.json file has been added to the app, go to buildscript > dependencies and add the AppGallery Connect plugin configuration.
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/'}
    }
} 

In Gradle 7.0 or later, configuration under allprojects > repositories is migrated to the project-level settings.gradle file.

The following is a configuration example of the settings.gradle file:

dependencyResolutionManagement {
    ...
    repositories {
        google()
        jcenter() 
        maven {url 'https://developer.huawei.com/repo/'}
    }
}
  • Related