6

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:

enter image description here

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.c

E/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 = null

E/HmsMapKit_TileCache_38: startUrlRequest Identity fail, do not has permission get tile. authResult :060011

PS: I have the exact same problem with this demo.

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
e.y66
  • 99
  • 10

2 Answers2

2

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.

   // In the entrance class (inherited from android.app.Application) of the app,
    // call the setApiKey method in the overridden onCreate() method. 
    public class MyApp extends Application {
        @Override
        public void onCreate() {
            super.onCreate();
           // Set the API key.
            MapsInitializer.setApiKey("Your API Key");
        }
    }

(2) Set the API key in Fragment or MapView.

@Override
    protected void onCreate(Bundle savedInstanceState) {
        Log.i(TAG, "onCreate: ");
        super.onCreate(savedInstanceState);
        // Set the API key before calling setContentView.
        MapsInitializer.setApiKey("Your API Key");
        setContentView(R.layout.basic_demo);

For details about different causes of this problem, You could aslo refer to this answer.

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
  • 1
    As I mentioned in the question, the problem is not on the code level and I have already done everything that you suggested. However, the number 6 in this [link](https://stackoverflow.com/questions/64465638/hms-map-kit-is-not-rendering/64475114#64475114) that you provided states that "your location might not be supported", but I'm not sure which location it refers to: (a) Developer's Huawei account, (b) Client's Huawei account, (c) Client's IP address (d) Client's network provider, (e) The devices distributed in the supposed country, or something else. Kindly clear this up if you can. – e.y66 Sep 07 '21 at 06:28
  • You could try to choose Settings > App Management, clear the cached data of the HMS core APK, and open the map app again to see if the problem exists. – zhangxaochen Sep 07 '21 at 06:55
  • As to number 6, Is the SIM card installed on your test device? If has SIM card , the service providers may be preferentially determined. – zhangxaochen Sep 07 '21 at 06:58
  • So suppose there's no SIM card installed in the device, and it's using a VPN connection, and the HMS core data is cleared. Would it work then, considering the number 6? – e.y66 Sep 07 '21 at 07:34
  • It is not related to the VPN. It is related to the region set by Huawei ID. You can set the region on Huawei AppGallery. – zhangxaochen Sep 07 '21 at 07:58
  • The region set in the Huawei AppGallery is of the supported countries. – e.y66 Sep 07 '21 at 08:04
  • hi@e.y66, in this case could you pls [submit a ticket online](https://developer.huawei.com/consumer/en/support/feedback/#/) provide a full log or capture complete logs and post them in a github repository for us to check this issue? – zhangxaochen Sep 07 '21 at 08:11
  • 1
    I would definitely do that. Thank you very much for responding. – e.y66 Sep 07 '21 at 08:13
1

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:

  1. open cmd
  2. run command cd [path to directory with keytool.exe file] for example: cd C:\Program Files\Java\jdk1.8.0_301\bin
  3. run command keytool -list -v -keystore [path to debug.keystore]\debug.keystore -alias androiddebugkey -storepass android -keypass android
  4. copy SHA-256 key and add it to AppGallery Connect -> Project Settings -> App information -> SHA-256 certificate fingerprint

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

tasjapr
  • 632
  • 4
  • 13