目录

Why is the reported data not displayed on the app debugging page after HUAWEI Analytics Kit is integrated?

Cause Analysis:

Possible causes are as follows:

Solution:

To correct the fault, perform the following steps:

1. Check whether you have enabled the advanced analytics function and the API management function (enabled by default).

2. Check whether the agconnect-services.json file is the original file without any modification.

3. Check whether the debug mode is enabled.

4. Check whether the log data is reported successfully. If the log contains resultCode: 200, the data is reported successfully. The possible causes are as follows:

Case 1: The tools:node parameters is set to "replace" (that is, tools:node="replace"). This causes the app configuration to conflict with AppGallery Connect SDK configurations, and therefore an exception occurs when the AppGallery Connect API is called to obtain the token.

Case 2: The configuration for excluding HUAWEI Analytics Kit from obfuscation is not added before you compile the APK. As a result, an exception occurs during the running of the APK.

For case 1, use the following procedure:

  1. Set tools:node to "merge" (that is, tools:node="merge").

  2. Manually write all information in the AndroidManifest.xml file of AppGallery Connect to the AndroidManifest.xml file of your app.

For case 2, use the following procedure:

  1. Open the obfuscation script file of your project.

  2. Add configurations to exclude HUAWEI Analytics Kit from obfuscation.

  1. -keep class com.hianalytics.android.**{*;}
  2. -keep class com.huawei.updatesdk.**{*;}
  3. -keep class com.huawei.hms.**{*;}
  4. -keep class com.huawei.agconnect.**{*;}
  5. -keep interface com.huawei.hms.analytics.type.HAEventType{*;}
  6. -keep interface com.huawei.hms.analytics.type.HAParamType{*;}

What should I do when data reporting fails and the server returns error code 401? An error message similar to the following is reported: "java.lang.RuntimeException: Unable to get provider com.huawei.agconnect.core.provider.AGConnectInitializeProvider: java.security.InvalidParameterException: url is null."

Cause Analysis:

The possible causes are as follows:

Solution:

For case 1: Sign in to AppGallery Connect and download the agconnect-services.json file.

For case 2: Sign in to AppGallery Connect and go to Project Setting > Manage APIs to enable the API permission.