The Maven repository address cannot be accessed from a browser. It can only be configured in the IDE. If there are multiple Maven repositories, add the Maven repository address of Huawei as the last one.
If you are using Android Studio, you can integrate the HMS Core SDK via the Maven repository. Before you start developing an app, integrate the HMS Core SDK into your Android Studio project.
If you have enabled certain services in AppGallery Connect, add the agconnect-services.json file to your app.
The procedure for configuring the Maven repository address in Android Studio is different for Gradle plugin earlier than 7.0, Gradle plugin 7.0, and Gradle plugin 7.1 or later. Click a relevant link below to find the configuration procedure for the specific Gradle plugin version.
The Maven repository address cannot be accessed from a browser. It can only be configured in the IDE. If there are multiple Maven repositories, add the Maven repository address of Huawei as the last one.
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. Please refer to AppGallery Connect Plugin Dependency to select a proper 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/'} } }
buildscript { repositories { google() jcenter() // Configure the Maven repository address for the HMS Core SDK. maven {url 'https://developer.huawei.com/repo/'} } dependencies { ... // Add the Android Gradle plugin configuration. You need to replace {version} with the actual Gradle plugin version, for example, 7.0.1. classpath 'com.android.tools.build:gradle:{version}' // Add the AppGallery Connect plugin configuration. Please refer to AppGallery Connect Plugin Dependency to select a proper plugin version. classpath 'com.huawei.agconnect:agcp:1.6.0.300' } }
dependencyResolutionManagement { ... repositories { google() jcenter() // Configure the Maven repository address for the HMS Core SDK. maven {url 'https://developer.huawei.com/repo/'} } }
buildscript { dependencies { ... // Add the Android Gradle plugin configuration. You need to replace {version} with the actual Gradle plugin version, for example, 7.1.1. classpath 'com.android.tools.build:gradle:{version}' // Add the AppGallery Connect plugin configuration. Please refer to AppGallery Connect Plugin Dependency to select a proper plugin version. classpath 'com.huawei.agconnect:agcp:1.6.0.300' } } plugins { ... }
pluginManagement { repositories { gradlePluginPortal() google() mavenCentral() // Configure the Maven repository address for the HMS Core SDK. maven { url 'https://developer.huawei.com/repo/' } } } dependencyResolutionManagement { ... repositories { google() mavenCentral() // Configure the Maven repository address for the HMS Core SDK. maven { url 'https://developer.huawei.com/repo/' } } }
dependencies{
implementation 'com.huawei.hms:identity:{version}'
}
Replace {version} with the actual SDK version number, for example, implementation 'com.huawei.hms:identity:6.13.0.300'. For details about the version number, please refer to Version Change History.
apply plugin: 'com.huawei.agconnect'
plugins { id 'com.android.application' // Add the following configuration: id 'com.huawei.agconnect' }
android { defaultConfig { ... resConfigs "en", "zh-rCN", "Other languages supported by your app" } }
For details about the languages supported by the HMS Core SDK, please refer to Languages Supported by the HMS Core SDK.
Open the modified build.gradle file again. You will find a Sync Now link in the upper right corner of the page. Click Sync Now and wait until synchronization is complete.
If an error occurs, check the network connection and the configuration in the Gradle files.