|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- - ##### 根据[华为推送服务配置文档](https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/android-config-agc-0000001050170137)完成应用创建和推送服务的开通
-
- - ##### 登录[AppGallery Connect](https://developer.huawei.com/consumer/cn/service/josp/agc/index.html)网站,点击“我的项目”。
-
- - ##### 在项目列表中找到您的项目,在项目中点击需要集成HMS Core SDK的应用。
-
- - ##### 在“项目设置 > 常规”页面的“应用”区域,点击“agconnect-services.json”下载配置文件。
-
- ![点击放大](https://alliance-communityfile-drcn.dbankcdn.com/FileServer/getFile/cmtyPub/011/111/111/0000000000011111111.20230221102806.12268288190126774767350517557615:50001231000000:2800:12ABACEF3849B9BA1E7CDABD51E96D6851FABECD55E05713EAAC7B0A487F73E1.png?needInitFileName=true?needInitFileName=true)
-
- - ##### 将“agconnect-services.json”文件拷贝到应用级根目录下。
-
- ![img](https://alliance-communityfile-drcn.dbankcdn.com/FileServer/getFile/cmtyPub/011/111/111/0000000000011111111.20230221102806.48189746150828014962362521369272:50001231000000:2800:A389367A1252831B6E662C4D5340473CB088CB9B317B4418003379F782052999.png?needInitFileName=true?needInitFileName=true)
-
- - ##### 配置HMS Core SDK的Maven仓地址
-
-
-
- Android Studio的代码库配置在Gradle插件7.0以下版本、7.0版本和7.1及以上版本有所不同。请根据您当前的Gradle插件版本,选择对应的配置过程。
-
- | [7.0以下版本](https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/android-integrating-sdk-0000001050040084#ZH-CN_TOPIC_0000001087049212__zh-cn_topic_0000001050041594_li547444421611) | [7.0版本](https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/android-integrating-sdk-0000001050040084#ZH-CN_TOPIC_0000001087049212__zh-cn_topic_0000001050041594_li1796424071918) | [7.1及以上版本](https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/android-integrating-sdk-0000001050040084#ZH-CN_TOPIC_0000001087049212__zh-cn_topic_0000001050041594_li1345452582116) |
- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
- | | | |
-
-
-
- - ##### 添加AGC插件配置。请根据实际情况选择:
-
- - 方式一:在文件头部声明下一行添加如下配置。
-
- ```groovy
- apply plugin: 'com.huawei.agconnect'
- ```
-
- - 方式二:在`plugins`中添加如下配置
-
- ```groovy
- plugins { id 'com.android.application' // 添加如下配置 id 'com.huawei.agconnect'}
- ```
-
-
-
- - ##### 配置签名
-
- 将[生成签名证书指纹](https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/android-config-agc-0000001050170137#section193351110105114)步骤中生成的签名文件拷贝到工程的app目录下,在build.gradle文件中配置签名。
-
- ```groovy
- android {
- signingConfigs {
- config {
- // 根据您实际的签名信息,替换以下参数中的xxxx
- keyAlias 'xxxx'
- keyPassword 'xxxx'
- storeFile file('xxxx.jks')
- storePassword 'xxxx'
- }
- }
-
- buildTypes {
- debug {
- signingConfig signingConfigs.config
- }
- release {
- signingConfig signingConfigs.config
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- }
- ```
-
- - ## 同步工程
-
- 在完成以上的配置后,点击工具栏中的gradle同步图标完成“build.gradle”文件的同步,然后将相关依赖下载到本地。
-
- ![img](https://alliance-communityfile-drcn.dbankcdn.com/FileServer/getFile/cmtyPub/011/111/111/0000000000011111111.20230221102807.71643474582974097971276481469874:50001231000000:2800:6E12E277C5CE78BD6042495DB9A695384BAEAFA3301E04B4BB0EBED6FB371E4A.png?needInitFileName=true?needInitFileName=true)
|