I have followed the documentation here and here (which are pretty straight forward), but the map view does not load any tiles.
I use HMS Toolkit, and the Configuration Wizard results in success. I also have set my api key, using this line in both my application class and my activity class onCreate.
MapsInitializer.setApiKey(HUAWEI_API_KEY);
Here is the device information and SDK version:
- Phone model: Huawei Y7 Prime 2018
- EMUI version: 8.0.0
- HMS Core version: 6.1.0.305
- Map SDK version: com.huawei.hms:maps:6.0.0.301
Here is the screen:
Relevant error logs:
E/HmsMapKit_MapView_151: createDelegate: creator == null
E/HmsMapKit_GrsClient_24: GRS returns empty.
E/HmsMapKit_ErrorTraceLogPusher_4: cache error trace log :
ErrorTraceLogDTO{ scenario = GET_GRS_URL_FAILED’, message=’GRS returns
empty, service name is com.huawei.hms.map.’}E/HmsMapKit_ErrorTraceLogPusher_12: eventId is null or empty.
E/HmsMapKit_AuthenticateClient_27: Exception occur
com.huawei.hms.maps.foundation.client.cE/HmsMapKit_ErrorTraceLogPusher_4: cache error trace log :
ErrorTraceLogDTO{ scenario = ACCESS_SERVICE_ERROR’, message=’060001 :
NETWORK_ERROR’}E/HmsMapKit_AuthenticateCache_0: authenticate error, throw
RetryException.E/HmsMapKit_CopyrightDelegate_27: get copyright statement html data
failed: htmlData = nullE/HmsMapKit_TileCache_38: startUrlRequest Identity fail, do not has
permission get tile. authResult :060011
PS: I have the exact same problem with this demo.
2
Answers
First you may refer to this Docs to see if there’s an error code.
The official demo also runs incorrectly. so there is a high probability that the problem is caused by a signature or API key problem.
Please check as follows:
Check whether the Map Kit API is enabled in AppGallery Connect. If not, enable it, download the .json file to replace the existing one in the code, and then check whether the SHA256 fingerprint is correct.
In the Map SDK 5.0.0.300 or later for Android, you must set an API key before initializing the map.
(1) Set the API key in the entrance class of your project.
(2) Set the API key in Fragment or MapView.
For details about different causes of this problem, You could aslo refer to this answer.
You need to generate and upload to AppGallery Connect two SHA-256 keys, one for debug version and one for release.
for generating key for debug version you need to:
cd [path to directory with keytool.exe file]
for example:
cd C:Program FilesJavajdk1.8.0_301bin
keytool -list -v -keystore [path to debug.keystore]debug.keystore -alias androiddebugkey -storepass android -keypass android
for release version do everything the same, but replace the path to the key for signing the release build in 2 step and enter real release alias and password in 3 step