有什么有效的方法可以使用 Android Studio 模拟器测试华为商店的应用程序?

Is there any effective way to test an app for the Huawei Store using Android Studio emulator?

我想知道是否有任何有效的方法可以使用 Android Studio 模拟器为华为商店测试应用程序。

我尝试禁用 Google Play 服务,但出于某种原因 Retrofit 请求停止工作:/

好吧,我在这里尝试让 Retrofit 在这种情况下工作,我找到了一种方法。 我不知道这是否是最好的解决方案,但无论如何我都会 post。

  • 禁用 Google 播放服务;
  • 强行停止您的应用;
  • 重启模拟器;
  • 检查它现在是否正常工作(如果没有,请再次尝试强制停止您的应用)。

P.S.: Google 播放服务 不是 re-enabled 重启后。

您可以使用AppGallery Connect 的云调试 来测试您的应用是否适用于华为设备。 云调试使用华为提供的主流华为设备测试您的应用程序。您可以运行您的应用在最新最流行的华为设备上测试应用功能。

  • 使用云调试
  1. 登录 AppGallery Connect 和 select 我的项目
  2. Select一个待测应用。
  3. 转到质量 > 云调试
  4. 按系列、Android版本、EMUI 版本和分辨率过滤设备。
  5. 在弹出的申请设备型号对话框中,根据需要设置调试时长。选项是30 分钟1 小时2 小时
  6. 等待设备初始化完成。
  7. 单击调试 选项卡。
  8. 点击上传上传APK。
  9. 查看APK上传进度,上传完成后安装APK。
  10. 在弹出的提示安装中的对话框中,点击确定。安装完成后,您可以在左侧设备屏幕上看到应用程序图标。
  11. 通过在设备屏幕上移动或单击光标,或者单击电源按钮、主页按钮、菜单按钮或返回按钮来操作设备。该设备将像您自己的设备一样响应 phone.

检查下面的截图:

您可以查看 the official documentation 以获得更完整的答案。

对于大多数情况,您只需获取 HMS Core APK 并将其安装到模拟器或物理设备上

You do not need for most cases Huawei device. Here is my battle-tested solution.

If you're implementing HMS (Huawei Mobile Services) feature like push notifications, sms retrieving or auth(orization) you can do simply:

  1. Grab HMS Core APK from: https://www.huaweicentral.com/download-the-latest-huawei-mobile-services-apk/
  2. Create new or run existing Android emulator via Android Studio or ADB
  3. Install HMS Core APK downloaded from 1.
  4. Go to Settings -> Apps & Notifications
  5. Make sure that HMS Core has required permissions like SMS for SMS retrieving or push notifications
  6. If you forget about 5., HMS library will return exception "Permissions not enabled"

I am pretty sure that instead of emulator you can use any of physical devices, grab APK and install HMS Core on it.

From:

编码愉快!