3

After following huawei setup docs https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides-V1/preparedevenv-0000001050032222-V1, maps still not render on our apps.. It just showing blank screen without any error show, on both emulator and real device

How to make it work? For your info, I already did:

  • Enable map kit api
  • Added agconnect-services.json inside my android/app

From logcat

11-03 14:53:54.449 W/dynamic-api_DynamicModule( 9322): 9322-9322|null|com.huawei.hms.maps.internal.HmsUtil|isFallbackPresent|5|Query remote module:huawei_module_maps exception:com.huawei.hms.feature.dynamic.DynamicModule$a: failed to Query remote version.
11-03 14:53:54.455 D/HmsMapKit_HmsUtil_47( 9322): get fallback version failed 
11-03 14:53:54.455 D/HmsMapKit_HmsUtil_65( 9322): get hms apk version  : 0 fallbackVersion : 0
11-03 14:53:54.456 D/HmsMapKit_HmsUtil_44( 9322): isInitialized is: falserepeatFlag is: true
11-03 14:53:54.457 I/HmsMapKit_HmsUtil_169( 9322): hmsVersionStr 5.0.1.300
11-03 14:53:54.457 I/HmsMapKit_HmsUtil_197( 9322): baseVersion 50001300
11-03 14:53:54.463 E/HMSSDK_HMSPackageManager( 9322): Failed to find HMS apk
11-03 14:53:54.466 E/HMSSDK_HMSPackageManager( 9322): Failed to find HMS apk
11-03 14:53:54.466 I/HmsMapKit_AvailableAdapter_39( 9322): HMS is not installed
11-03 14:53:54.467 I/HmsMapKit_HmsUtil_226( 9322): Hms is :1
11-03 14:53:54.469 D/HmsMapKit_HmsUtil_4( 9322): Hms is resolution :
11-03 14:53:54.471 E/HMSSDK_HMSPackageManager( 9322): Failed to find HMS apk


11-03 14:53:54.513 E/ActivityThread( 9322): Failed to find provider info for com.huawei.hms
11-03 14:53:54.514 W/dynamic-api_DynamicModule( 9322): 9322-9322|null|com.huawei.hms.feature.dynamic.DynamicModule|load|25|Get hms loader info failed:failed to get :huawei_module_dynamicloader info.
11-03 14:53:54.517 W/dynamic-api_AssetLoadManager( 9322): 9322-9322||a.a.a.b.a.a|a|6|No module apk in asset path.
11-03 14:53:54.518 W/dynamic-api_DynamicModule( 9322): 9322-9322|null|com.huawei.hms.feature.dynamic.DynamicModule|load|25|No available dynamic loader in HMS and asset.
11-03 14:53:54.518 E/HmsMapKit_MapCreator_49( 9322): Loading mapRoute dynamically failed, exception is com.huawei.hms.feature.dynamic.DynamicModule$LoadingException: Cannot find a valid dynamicLoader in HMS and local.
11-03 14:53:54.519 E/HmsMapKit_MapCreator_28( 9322): getRemoteMapContext failed
11-03 14:53:54.521 D/HmsMapKit_MapView_4( 9322): getMapAsync:


Vina
  • 139
  • 7

1 Answers1

2

There may be different causes of this 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);
  • Currently, HuaweiMap supports two types of maps. Determine the type that you are using.

    MAP_TYPE_NORMAL: standard map, which shows roads, artificial structures, and natural features such as rivers.

    MAP_TYPE_NONE: empty map without any data.

You could also refer to this answer.

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
  • these step, set the API key in the entrance class of your project and set the API key in Fragment or MapView, is this for react native setup? – Vina Nov 03 '21 at 03:43
  • also I read on https://developer.huawei.com/consumer/en/doc/development/HMSCore-References/mapsinitializer-0000001050150366 it said about setApiKey "This method does not need to be called if the api_key field in the agconnect-services.json file already specifies an API key." which our agconnect-services.json already had – Vina Nov 03 '21 at 04:14
  • hi@Vina, could you pls provide your complete log, so that we can analyse your problem. You can get the complete log from the following steps. `adb logcat -c && adb logcat -vtime > logcat1.txt` – zhangxaochen Nov 03 '21 at 07:28
  • hi thanks for replying back @shirley, I updated my question with some logcat – Vina Nov 03 '21 at 08:49
  • hi@@Vina, according to the log:`11-03 14:53:54.466 E/HMSSDK_HMSPackageManager( 9322): Failed to find HMS apk`, may i ask Is the phone you are using a Huawei phone and does not have the HMS Core APK installed? – zhangxaochen Nov 03 '21 at 09:00
  • hi @shirley tested on android 10 device with hms installed from google play store – Vina Nov 03 '21 at 09:10
  • ahhh sorry @shirley the version on google was outdated, do you have link for the latest hms core? or can we debugging react native app locally using hms cloud debugging? we don't have actual huawei device to test it – Vina Nov 03 '21 at 09:17
  • yes, of course you can use cloud debugging to test that. – zhangxaochen Nov 03 '21 at 09:34
  • The version of the HMS Core apk on the Google Store was outdated. It is recommended that you use the SDK for the upgrade boot prompt, you could follow [this docs](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-sdk-integrating-sdk-0000001061671869#section14837619928). – zhangxaochen Nov 03 '21 at 09:35