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

Viewed 3785

I would like to know if there is any effective way to test an app for Huawei Store using an Android Studio emulator.

I tried disabling the Google Play Services, but for some reason Retrofit requests stopped working :/

3 Answers

You can use Cloud Debugging of AppGallery Connect to test your app for Huawei Devices. Cloud Debugging tests your app using mainstream Huawei devices provided by Huawei. You can run your app on the latest and most popular Huawei devices to test app functions.

  • Work with Cloud Debugging
  1. Sign in to AppGallery Connect and select My projects.
  2. Select an app to be tested.
  3. Go to Quality > Cloud Debugging.
  4. Filter devices by Series, Android version, EMUI version, and Resolution.
  5. In the Apply for device model dialog box that is displayed, set Debug duration based on your needs. The options are 30 min, 1 h, and 2 h.
  6. Wait for the device initialization to finish.
  7. Click the Debugging tab.
  8. Click Upload to upload an APK.
  9. Check the APK upload progress and install the APK after the upload is complete.
  10. In the displayed dialog box indicating that the app is being installed, click OK. When the installation is complete, you can see the app icon on the device screen on the left.
  11. Operate the device by moving or clicking your cursor on the device screen, or clicking the power button, home button, menu button, or back button. The device will respond like your own phone.

Check Screenshot below: enter image description here

You can check out the official documentation for a more complete answer.

Well, I was trying here to make Retrofit work in this condition and I found a way. I don't know if it is the best solution, but I will post it anyway.

  • disable the Google Play Services;
  • force stop your app;
  • restart the emulator;
  • check if it is working now (if not, try to force stop your app again).

P.S.: Google Play Services is not re-enabled upon reboot.

For most cases, you can simply grab HMS Core APK and install it on emulator or physical device

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: https://stackoverflow.com/a/63790263/4730812

Happy coding!

Related