DEV Community

Cover image for Troubleshooting for Huawei's App Performance Management SDK
Zachary Powell
Zachary Powell

Posted on

Troubleshooting for Huawei's App Performance Management SDK

I encountered a few issues in the process of integrating the APM SDK. In this post, I will share these cases for you, so that you will have a sense of how to resolve them.

Issue 1: Error "miss client id" Is Reported After the APM SDK Is Integrated

The detailed error message is as follows:

I/com.huawei.agc.apms: failed to fetch remote config: client token request miss client id, please check whether the 'agconnect-services.json' is configured correctly


By searching through the forum, I found that the issue is caused by the absence of the AppGallery Connect plugin. For details, please refer to this forum post.
To solve the problem, just add the following code to the app-level build.gradle file:

apply plugin: 'com.huawei.agconnect'

Issue 2: Cannot Find the Reported APM Logs on the Device

When the APM SDK is integrated, there was no app performance data on the App performance management page. I wanted to locate the problem based on the Logcat logs on the device.

However, I wasn't sure how to find the APM logs.


I checked the APM documentation and found out how to access the logs:

Open the AndroidManifest.xml file of the app, and add the meta-data element to application.

      android:value=" true" /> 
Enter fullscreen mode Exit fullscreen mode

After the APM debug log function is enabled, you can use the Logcat log filter function com.huawei.agc.apms or apms to view the logs.
Please note that only the value of resultCode is 200 indicates that the data is reported successfully.

I/HiAnalyticsSDK: SendMission=> events PostRequest sendevent TYPE : oper, TAG : APMS, resultCode: 200 ,reqID:b639daae0490c378cf242544916a9c36


Issue 3: No Successfully Uploaded AMPS Logs in the Logcat.

The meta-data element has been added and set to true. The contains and sending logs can be viewed in the Logcat, with the exception of the successfully uploaded AMPS logs.


The check result shows that the agconnect-services.json file was downloaded before the APM service was enabled. This indicates that it needs to be updated.

Before the service was enabled, the JSON file contained only 29 lines. After the service was enabled, more parameters were added to the file that it has contained 52 lines.
Update the JSON file, and you'll be able to view the successfully uploaded AMP logs.

Issue 4: No APM Data Displayed in AppGallery Connect While Logs Are Available

When locating this problem, I found a log in which the result code is 200. However, still no APM data is available in AppGallery Connect.
The corresponding logs are as follows:

I/HiAnalyticsSDK: hmsSdk=> events PostRequest sendevent TYPE : maint, TAG : _hms_config_tag, resultCode: 200 ,reqID:842927417075465ab9ad990e2ce92646


The value of TAG in the preceding log is not APMS. Therefore, it cannot be the log that indicates that the APM data is successfully loaded.
I analyzed the logs and found some authentication failure logs.

E/HiAnalyticsSDK: HttpTransportCommander=> NE-004|IO Exception.timeout
D/HiAnalyticsSDK: HttpTransportCommander=> request times: 1
I/HiAnalyticsSDK: getPubKey=> result code : -102

After contacting Huawei technical support, I learned that the data reporting channel of the HiAnalyticsSDK used by APM has an authentication problem.
I went to My projects > HUAWEI Analytics in AppGallery Connect and enabled HUAWEI Analytics. After a while, the authentication was successful.

Issue 5: No Related Network Request Performance Data Is Displayed.

All of the performance data is normal with the exception of the network request data, which is not displayed in AppGallery Connect.


According to the official documentation, obtaining network request data depends on the APM plugin. The data can only be obtained after the APM plugin has been correctly integrated.
To integrate the plugin, do as follows:

  1. In the project-level build.gradle file, add the following code in dependencies:
    classpath 'com.huawei.agconnect:agconnect-apms-plugin:'

  2. In the app-level build.gradle file, add the following code:
    apply plugin: 'com.huawei.agconnect.apms'

Discussion (0)