skip to Main Content

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.

2

Answers


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

    Login or Signup to reply.
  2. 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 FilesJavajdk1.8.0_301bin
    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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search