智能客服
你问我答,随时在线为你解决问题
日落公告:HMS Toolkit服务当前已不再进行版本更新。中国区域的服务将在2026-11-30日落下线,日落后将不再提供服务。
HMS Toolkit是一个IDE工具插件,提供一套含应用创建、编码和转换、调测、测试和发布的开发工具。可以帮助您以更低的开发成本和更高的开发效率集成HMS Core服务。
HMS Toolkit的“Configuration Wizard”为您提供配置向导,借助该工具可将“开发准备”中多个模块的手动操作自动化完成。
Windows平台:打开Android Studio,选择,在搜索框中输入“HMS Toolkit”,然后点击“Install”进行安装。安装完成后,请重启Android Studio。
MacOS平台:打开Android Studio,选择,在搜索框中输入“HMS Toolkit”,然后点击“Install”进行安装。安装完成后,请重启Android Studio。
在开发应用前,您需要在AppGallery Connect中创建应用,并设置应用的相关信息。
配置完成后,无需根据界面向导进行下一步操作,按照配置HMS Toolkit环境进行操作,工具会自动进行设置。
在调用Scan Kit能力前,您还需要进行环境配置。
如果您还未登录AppGallery Connect,工具会自动打开浏览器提示您进行登录和授权。
您在选择团队名称和对应的工程模块之后,HMS Toolkit会自动检测AppGallery Connect上是否有对应的应用。若有以下报错,请根据界面提示点击“Link”到AppGallery Connect上检查是否已创建应用。

报错修复后的界面如下:

HMS Toolkit会自动对Scan Kit的使用环境进行环境配置检查,包括通用环境配置检查和Kit专用环境配置检查。

序号 | 环境配置检查项 | 失败时处理建议 |
|---|---|---|
1 | Obtain the package name of your application | 需要提前在AppGallery Connect中创建一个应用,并且对应的包名需要与当前模块的包名保持一致。 说明 HMS Toolkit只会根据当前应用的包名,去AppGallery Connect中查询对应的应用,不会主动创建应用。包名对应的是模块下的build.gradle中android.defaultConfig.applicationId。 |
2 | Check whether there is any app corresponding to your application's package name in AppGallery Connect | |
3 | Verify the package name | 该配置项是校验包名是否以“.huawei”或“.HUAWEI”结尾,只有联运游戏的应用才需要此限制。 |
4 | Generate a signing certificate | 如果选择您生成的证书文件,请检查证书文件是否创建成功,keyPassword和storePassword是否输入正确。 |
5 | Configure signing certificate information | |
6 | Generate a certificate fingerprint | |
7 | Configure the certificate fingerprint in AppGallery Connect | 请手工拷贝SHA256证书指纹,填写到“Generate a certificate fingerprint”检查项下面的输入框内,或点击插件界面提示的链接,将SHA256证书指纹填写到应用中。 |
8 | Check whether the data storage location was set | 点击插件界面提示的链接,手动设置数据存储区域。 |
9 | Check whether the required xxx Kit service was enabled | 开通对应的Kit服务,单击插件界面提示的链接,然后手动开通服务。 服务开通后,还需要在AppGallery Connect界面点击左侧的“项目设置 > API管理”,打开对应的Kit API。 |
10 | Check whether the required xxx Kit API was enabled | |
11 | Download the agconnect-services.json file | 确保AppGallery Connect中创建应用的包名与选择的工程模块的包名完全一致。 |
12 | Copy the agconnect-services.json file to the module directory | |
13 | Add the HMS Maven repository address to the build.gradle file in the project directory for xxx Kit | 无需手动处理。 |
14 | Add dependencies from AppGallery Connect to the build.gradle file in the project directory for xxx Kit | |
15 | Add dependencies from AppGallery Connect to the build.gradle file in the module directory for xxx Kit | |
16 | Add dependencies from the xxx Kit SDK to the build.gradle file in the module directory | |
17 | Configure obfuscation scripts of xxx Kit |

选择,然后在Kit列表中点击“Scan Kit”,整个Scan Kit的场景如下图:

选择要进行开发的场景卡片,以“Default View”为例,拖拽整个卡片到代码区域生成Default View扫描模式相关代码。

当您直接拖动场景卡片时,工具会自动生成对应的Activity文件和XML布局文件,并在AndroidManifest.xml、项目级的build.gradle和应用级的build.gradle文件中写入配置信息和工程运行所需要的依赖。如果需要打开该Activity,需要您在代码中主动调用该Activity,完成后,您可以直接在设备中运行应用。
Customized View 、Bitmap API(相机扫码模式、图片扫码模式)、MultiProcessor API、构建码生成功能、码值解析代码等其他业务介绍、代码调用示例请参见其他的卡片,通过拖拽或者拷贝的方式进行开发,同时也可以参见统一扫码服务开发指南中的内容进行手动开发。
完成上述代码后,可以使用HMS Toolkit中的Cloud Debugging来进行真机调试,具体可以参见Cloud Debugging。



在菜单栏中点击
(Run按钮)或
(Debug按钮),在本地真机中运行或调试App。




Test Duration:(可选)仅测试类别选择“Stability Test”生效,设置测试周期,范围为10~60分钟。


点击“Download report”,可以将测试报告下载到本地,点击
,可以查看测试详情。各测试项的报告说明请参见云测试指南。

您的应用程序开发、调试完成后,可以直接通过HMS Core提供的Publish to AppGallery Connect功能,将您的应用程序APK文件发布到华为应用市场。
上传APK文件会有如下两个检验,如有报错,请修改后重新上传。
>keytool -printcert -jarfile 工程目录下的app-release.apk路径 “工程目录下的app-release.apk路径”请根据实际路径进行替换。


