[Huawei Developers] John Wo:
Introduction:

In this section let us see what are basic issues faced by developers while integrating HMS analytics kits. Huawei developer sites provide excellent guides to integrate easy way. But if you still end up hitting road blocks please refer below blog, which will help you fix those.

What are the tags to check when analysing analytics kit logs? I have gathered below tags and information from analytics logs, this will help you have better idea about how logic flows in the analytics kit.

Tags/Strings you can search for in the logs:

HiAnalyticsSDK

AAID Processor

Token Processor

regHMSEvent()

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/745/308/2640091000001745308.20201110021721.97222373795242981618230014998228:50511124024415:2800:E29B8617622FE3C0D489588083F2CD4003FCE79D839E75823F872FA9FC89C9D5.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/001/745/308/2640091000001745308.20201110021721.97222373795242981618230014998228:50511124024415:2800:E29B8617622FE3C0D489588083F2CD4003FCE79D839E75823F872FA9FC89C9D5.png[/IMG]

How to take android logs?

In general, taking android logs you will get lot of information regarding the other applications and system infos. To filter analytics sdk specific logs, search for HiAnalyticsSDK tag in android logs. This can narrow down our search a lot.

adb logcat | findstr "HiAnalyticsSDK"

Are you missing agconnect-services.json?

If you forgot to add agconnect-services.json in the application you will facing this above error. So add your agconnect-services from app-gallery connect. There you go that is straight forward.

java.lang.RuntimeException: Unable to get provider com.huawei.agconnect.core.provider.AGConnectInitializeProvider: java.security.InvalidParameterException: url is null

Have you enabled the analytics kit in AG-Connect?

If you have forgot to enable Analytics APIs in AG-Connect or if you have setHiAnalyticsInstance.setAnalyticsEnabled(false) the you will have this in your logs.

HiAnalyticsKit: HiAnalyticsLoginService=> service onBind
HiAnalyticsSDK: HAServiceConnection=> onServiceConnected
HiAnalyticsSDK: HAServiceConnection=> onServiceDisconnected

Enable the Analytics using the API HiAnalyticsInstance.setAnalyticsEnabled(true) and check the logs.and Select any menu under HUAWEI Analytics and click Enable Analytics service. (Only users with the management permission can perform this operation.) Now it will be fine.

HiAnalyticsKit: HiAnalyticsLoginService=> service onBind
HiAnalyticsSDK: HAServiceConnection=> onServiceConnected
HiAnalyticsSDK: HAServiceConnection=> Upload info is correct
HiAnalyticsKit: HiAnalyticsUtil=> http header pkgName: com.huawei.hms.analytics
HiAnalyticsKit: HiAnalyticsUtil=> analytics sdk start init

Are you facing SHA-ID signature mismatch?

Huawei developer’s portal has easy way to add SHA-ID in your application and AG-Connect. If you somehow messed it up or when the sha-id in AG-Connect and application mismatch, then we will have this error in the logs.

HiAnalyticsSDK: TokenProcessor=> SE-003|Failed to obtain token from agconnect sdk, token is empty
HiAnalyticsSDK: TokenProcessor=> success: 0
HiAnalyticsSDK: TokenProcessor=> SE-003|Failed to obtain token from agconnect sdk, token is empty
HiAnalyticsSDK: TokenProcessor=> success: 0
HiAnalyticsSDK: EventReportTask=> agc token is empty, stop event report.

Recreate and do the generate signature again to fix the issue

HiAnalyticsSDK: TokenProcessor=> start get token from agc
HiAnalyticsSDK: AAIDProcessor=> Task<String>.addOnSuccessListener onSuccess!
HiAnalyticsSDK: TokenProcessor=> success: 172800

Is your events not registered?

If you haven't registered the events regHMSEvent() in the code you will face below logs.

HiAnalyticsSDK AAIDProcessor=> begin sync aaid from opendevice sdk
HiAnalyticsSDK AAIDProcessor=> get aaid success
HiAnalyticsSDK TokenProcessor=> start get token from agc
HiAnalyticsSDK EventRecordTask=> Begin to run EventRecordTask...
HiAnalyticsSDK TokenProcessor=> success: 172800
HiAnalyticsSDK EventRecordTask=> Begin to run EventRecordTask...
HiAnalyticsSDK EventRecordTask=> Begin to run EventRecordTask...

Register your events to fix the issue using regHMSEvent()

HiAnalyticsSDK AAIDProcessor=> begin sync aaid from opendevice sdk
HiAnalyticsSDK AAIDProcessor=> get aaid success
HiAnalyticsSDK TokenProcessor=> start get token from agc
HiAnalyticsSDK: HiAnalyticsInstanceManager=> regHmsSvcEvent is execute
HiAnalyticsSDK EventRecordTask=> Begin to run EventRecordTask...
HiAnalyticsSDK TokenProcessor=> success: 172800

More details, you can visit https://forums.developer.huawei.com/forumPortal/en/topic/0204400503644150106