Hi, I can load the Huawei Map on my devices successfully, but when I set the myLocationEnabled equal to true, the app crashed immediately on Huawei Nova 3i (Android 9) device.
However, the Huawei Map with myLocationEnabled equal to true can works without any issues in both of my Huawei P30 (Android 10) and Huawei Nova 7i (Android 10) devices.
Here is the log when the crash happened.
E/HMSSDK_AGCUtils(30502): Get appId with AGConnectServicesConfig failed
E/HMSSDK_AGCUtils(30502): Get cpid with AGConnectServicesConfig failed
I/HMSSDK_AGCUtils(30502): In getMetaDataCpId, Failed to read meta data for the CpId.
I/HMSSDK_HMSBIInitializer(30502): Builder->biInitFlag :false
I/HMSSDK_HMSBIInitializer(30502): Builder->biSetting :false
I/HMSSDK_CountryCodeBean(30502): getCountryCode get country code from SIM_COUNTRY
W/HMSSDK_CountryCodeBean(30502): countryCode from system language is not reliable.
E/HMSSDK_HMSBIInitializer(30502): Failed to get device issue country
I/HmsMapKit_HuaweiMapImpl_116(30502): setMyLocationEnabled: true
W/RenderEngine_IMap(30502): 地图未初始化完成。
I/HMSSDK_LocationClientImpl(30502): |4abe6a15-bd2d-4c2c-9e9f-9375d95b536d|checkLocationSettings
I/HMSSDK_HiAnalyticsUtil(30502): not ChinaROM
I/HMSSDK_HiAnalyticsUtil(30502): hw_app_analytics_state value is 0
D/HmsMapKit_HuaweiMapImpl_240(30502): getUiSettings:
D/HmsMapKit_UISettings_24(30502): UISettings:
I/HmsMapKit_UISettingImp_169(30502): setMyLocationButtonEnabled: true
I/HMSSDK_HuaweiApiManager(30502): sendRequest
I/HMSSDK_BaseHmsClient(30502): ====== HMSSDK version: 50000300 ======
I/HMSSDK_BaseHmsClient(30502): Enter connect, Connection Status: 1
I/HMSSDK_BaseHmsClient(30502): connect minVersion:30000000
I/HiTouch_HiTouchSensor(30502): HiTouch restricted: Sub windows restricted.
D/HiTouch_PressGestureDetector(30502): onAttached, package=com.herdhr.herdhrpersonal, windowType=2037, mHiTouchRestricted=true
I/HMSSDK_Util(30502): available exist: true
E/HMSSDK_Util(30502): In isAvailableLibExist, Failed to read meta data for the availableLoaded.
I/HMSSDK_Util(30502): available exist: true
I/MapRender(30502): ERROR MapView.cpp:318: MapView::[SwitchMapType] enter!
I/HMSSDK_HMSPackageManager(30502): current versionCode:50002301, minimum version requirements: 30000000
I/HMSSDK_HMSPackageManager(30502): MinApkVersion is disabled.
I/HMSSDK_BaseHmsClient(30502): check available result: 0
I/HMSSDK_BaseHmsClient(30502): enter bindCoreService
I/MapRender(30502): ERROR MapView.cpp:318: MapView::[SwitchMapType] enter!
D/mali_winsys(30502): EGLint new_window_surface(egl_winsys_display *, void , EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/OpenGLRenderer(30502): HWUI Binary is enabled
D/mali_winsys(30502): EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
I/MapRender(30502): ERROR TextureCache.cpp:100: Fail to create texture with url img/native.png
I/HMSSDK_BinderAdapter(30502): Enter onServiceConnected.
I/HMSSDK_BaseHmsClient(30502): Enter onServiceConnected.
I/HMSSDK_LocationClientBuilder(30502): onConnected, send suspended requests
I/HMSSDK_LocationClientBuilder(30502): onConnected, requests cache list is empty
I/HMSSDK_HmsClient(30502): post msg api_name:location.checkLocationSettings, app_id:102751379|, pkg_name:com.herdhr.herdhrpersonal, sdk_version:50000300, session_id:, transaction_id:102751379ttings20200907161238560504173, kitSdkVersion:0, apiLevel:1
D/HmsMapKit_MapViewImpl_94(30502): onMapReady
I/HMSSDK_BaseAdapter(30502): in baseRequest + uri is :location.checkLocationSettings, transactionId is : 102751379ttings20200907161238560504173
I/HMSSDK_PendingResultImpl(30502): init uri:location.checkLocationSettings
I/HMSSDK_PendingResultImpl(30502): setResultCallback
D/HmsMapKit_HuaweiMap_110(30502): HuaweiMap:
D/HmsMapKit_HuaweiMapImpl_216(30502): setTrafficEnabled: false
D/HmsMapKit_HuaweiMapImpl_98(30502): setBuildingsEnabled: true
I/HmsMapKit_HuaweiMap_1339(30502): onInfoWindowClick setListener start:
D/HmsMapKit_HuaweiMapImpl_520(30502): setOnInfoWindowClickListener
I/HmsMapKit_HuaweiMap_198(30502): setCameraMoveListener:
D/HmsMapKit_HuaweiMapImpl_443(30502): setCameraMoveListener
I/HmsMapKit_HuaweiMap_157(30502): setOnCameraMoveStartedListener:
D/HmsMapKit_HuaweiMapImpl_434(30502): setCameraMoveStartedListener
I/HmsMapKit_HuaweiMap_178(30502): setOnCameraIdleListener:
D/HmsMapKit_HuaweiMapImpl_461(30502): setCameraIdleListener: success
I/HmsMapKit_HuaweiMap_897(30502): onMarkerClick setListener start:
D/HmsMapKit_HuaweiMapImpl_565(30502): onMarkerClick trans start
I/HmsMapKit_HuaweiMap_947(30502): onMarkerDrag setListener start:
D/HmsMapKit_HuaweiMapImpl_574(30502): iOnMarkerDragListener: success
I/HmsMapKit_HuaweiMap_1064(30502): setOnPolygonClickListener:
D/HmsMapKit_HuaweiMapImpl_493(30502): setPolygonClickListener: success
I/HmsMapKit_HuaweiMap_1029(30502): setOnCircleClickListener:
D/HmsMapKit_HuaweiMapImpl_502(30502): setPolylineClickListener: success
I/HmsMapKit_HuaweiMap_994(30502): onCircleClick setListener start:
D/HmsMapKit_HuaweiMapImpl_484(30502): onCircleClick trans start
I/HmsMapKit_HuaweiMap_1088(30502): setOnMapClickListener:
D/HmsMapKit_HuaweiMap_1116(30502): setOnMapLongClickListener
D/HmsMapKit_HuaweiMapImpl_583(30502): setOnMapLongClickListener
D/HmsMapKit_HuaweiMapImpl_269(30502): addMarker start:
D/HmsMapKit_HuaweiMapImpl_269(30502): setAnchor by old Interface
D/HmsMapKit_MarkerImpl_1797(30502): setRotation:
D/HmsMapKit_MarkerImpl_1798(30502): setDraggable:
D/HmsMapKit_MarkerImpl_56(30502): getId:
D/HmsMapKit_MarkerImpl_56(30502): getId:
E/HMSSDK_AGCUtils(30502): Get appId with AGConnectServicesConfig failed
E/HMSSDK_AGCUtils(30502): Get cpid with AGConnectServicesConfig failed
I/HMSSDK_AGCUtils(30502): In getMetaDataCpId, Failed to read meta data for the CpId.
I/HMSSDK_HMSBIInitializer(30502): Builder->biInitFlag :false
I/HMSSDK_HMSBIInitializer(30502): Builder->biSetting :false
I/HMSSDK_CountryCodeBean(30502): getCountryCode get country code from SIM_COUNTRY
W/HMSSDK_CountryCodeBean(30502): countryCode from system language is not reliable.
E/HMSSDK_HMSBIInitializer(30502): Failed to get device issue country
E/libEGL (30502): call to OpenGL ES API with no current context (logged once per thread)
I/MapRender(30502): ERROR TextureCache.cpp:100: Fail to create texture with url img/native.png
I/HMSSDK_LocationClientImpl(30502): |f7a97fbc-d27d-4604-a9c2-757640d255c2|checkLocationSettings
D/HmsMapKit_HuaweiMapImpl_240(30502): getUiSettings:
I/HMSSDK_PendingResultImpl(30502): setResult:0
D/HmsMapKit_UISettings_24(30502): UISettings:
I/HMSSDK_HuaweiApiManager(30502): sendRequest
I/HmsMapKit_UISettingImp_169(30502): setMyLocationButtonEnabled: true
I/HMSSDK_HmsClient(30502): post msg api_name:location.checkLocationSettings, app_id:102751379|, pkg_name:com.herdhr.herdhrpersonal, sdk_version:50000300, session_id:, transaction_id:102751379ttings20200907161238637151015, kitSdkVersion:0, apiLevel:1
I/HMSSDK_BaseAdapter(30502): in baseRequest + uri is :location.checkLocationSettings, transactionId is : 102751379ttings20200907161238637151015
I/HMSSDK_PendingResultImpl(30502): init uri:location.checkLocationSettings
I/HMSSDK_PendingResultImpl(30502): setResultCallback
I/MapRender(30502): WARNING Atlas.cpp:135: Glyph not found for 0x20
I/HmsMapKit_HuaweiMap_163(30502): onCameraMoveStarted: 3
I/HmsMapKit_HuaweiMap_203(30502): onCameraMove:
I/HmsMapKit_HuaweiMap_183(30502): onCameraIdle:
I/HMSSDK_BaseAdapter(30502): baseCallBack.onComplete
E/ (30502): [ZeroHung]zrhung_get_config: Get config failed for wp[0x0008]
I/HMSSDK_HmsClient(30502): receive msg status_code:0, error_code0, api_name:location.checkLocationSettings, app_id:102751379|, pkg_name:com.herdhr.herdhrpersonal, session_id:, transaction_id:102751379ttings20200907161238560504173, resolution:null
I/HMSSDK_CheckLocationSettingsTaskApiCall(30502): |4abe6a15-bd2d-4c2c-9e9f-9375d95b536d|doExecute
I/HmsMapKit_HuaweiMapImpl_0(30502): check location settings onFailure
D/AndroidRuntime(30502): Shutting down VM
E/AndroidRuntime(30502): FATAL EXCEPTION: main
E/AndroidRuntime(30502): Process: com.herdhr.herdhrpersonal, PID: 30502
E/AndroidRuntime(30502): java.lang.ClassCastException: io.flutter.plugin.platform.SingleViewPresentation$PresentationContext cannot be cast to android.app.Activity
E/AndroidRuntime(30502): at com.huawei.hms.maps.provider.huawei.c$13.b(:463)
E/AndroidRuntime(30502): at o.ea$5.run(Unknown Source:0)
E/AndroidRuntime(30502): at android.os.Handler.handleCallback(Handler.java:907)
E/AndroidRuntime(30502): at android.os.Handler.dispatchMessage(Handler.java:105)
E/AndroidRuntime(30502): at android.os.Looper.loop(Looper.java:216)
E/AndroidRuntime(30502): at android.app.ActivityThread.main(ActivityThread.java:7625)
E/AndroidRuntime(30502): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(30502): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
E/AndroidRuntime(30502): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
I/HmsMapKit_CrashHandler_136(30502): uncaughtException
D/HmsMapKit_CrashHandler_86(30502): logLength is 646
E/HmsMapKit_CrashHandler_86(30502): uncaughtException stacktrace is java.lang.ClassCastException: io.flutter.plugin.platform.SingleViewPresentation$PresentationContext cannot be cast to android.app.Activity
E/HmsMapKit_CrashHandler_86(30502): at com.huawei.hms.maps.provider.huawei.c$13.b(:463)
E/HmsMapKit_CrashHandler_86(30502): at o.ea$5.run(Unknown Source:0)
E/HmsMapKit_CrashHandler_86(30502): at android.os.Handler.handleCallback(Handler.java:907)
E/HmsMapKit_CrashHandler_86(30502): at android.os.Handler.dispatchMessage(Handler.java:105)
E/HmsMapKit_CrashHandler_86(30502): at android.os.Looper.loop(Looper.java:216)
E/HmsMapKit_CrashHandler_86(30502): at android.app.ActivityThread.main(ActivityThread.java:7625)
E/HmsMapKit_CrashHandler_86(30502): at java.lang.reflect.Method.invoke(Native Method)
E/HmsMapKit_CrashHandler_86(30502): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
E/HmsMapKit_CrashHandler_86(30502): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
E/HmsMapKit_CrashHandler_86(30502): deviceModel is INE-LX2 emuiVersion is EmotionUI_9.1.0 packageName is com.herdhr.herdhrpersonal rom version is INE-LX2 9.1.0.248(C636E1R1P1)
I/HMSSDK_PendingResultImpl(30502): setResult:0
D/HmsMapKit_MapReportProvider_153(30502): recordErrorLog errorReportInfo is :BaseReportInfo{className='com.huawei.hms.maps.report.CrashHandler', apiName='uncaughtException', errorCode='999999', startTime=1599466358764}ErrorReportInfo{errorMsg='java.lang.ClassCastException: io.flutter.plugin.platform.SingleViewPresentation$PresentationContext cannot be cast to android.app.Activity
D/HmsMapKit_MapReportProvider_153(30502): at com.huawei.hms.maps.provider.huawei.c$13.b(:463)
D/HmsMapKit_MapReportProvider_153(30502): at o.ea$5.run(Unknown Source:0)
D/HmsMapKit_MapReportProvider_153(30502): at android.os.Handler.handleCallback(Handler.java:907)
D/HmsMapKit_MapReportProvider_153(30502): at android.os.Handler.dispatchMessage(Handler.java:105)
D/HmsMapKit_MapReportProvider_153(30502): at android.os.Looper.loop(Looper.java:216)
D/HmsMapKit_MapReportProvider_153(30502): at android.app.ActivityThread.main(ActivityThread.java:7625)
D/HmsMapKit_MapReportProvider_153(30502): at java.lang.reflect.Method.invoke(Native Method)
D/HmsMapKit_MapReportProvider_153(30502): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
D/HmsMapKit_MapReportProvider_153(30502): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
D/HmsMapKit_MapReportProvider_153(30502): '}
W/HmsMapKit_MapTracker_159(30502): is not Allow Report
I/HmsMapKit_MapReportManager_1060(30502): record error log success. apiName: uncaughtException ,errorMessage: java.lang.ClassCastException: io.flutter.plugin.platform.SingleViewPresentation$PresentationContext cannot be cast to android.app.Activity
I/HmsMapKit_MapReportManager_1060(30502): at com.huawei.hms.maps.provider.huawei.c$13.b(:463)
I/HmsMapKit_MapReportManager_1060(30502): at o.ea$5.run(Unknown Source:0)
I/HmsMapKit_MapReportManager_1060(30502): at android.os.Handler.handleCallback(Handler.java:907)
I/HmsMapKit_MapReportManager_1060(30502): at android.os.Handler.dispatchMessage(Handler.java:105)
I/HmsMapKit_MapReportManager_1060(30502): at android.os.Looper.loop(Looper.java:216)
I/HmsMapKit_MapReportManager_1060(30502): at android.app.ActivityThread.main(ActivityThread.java:7625)
I/HmsMapKit_MapReportManager_1060(30502): at java.lang.reflect.Method.invoke(Native Method)
I/HmsMapKit_MapReportManager_1060(30502): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
I/HmsMapKit_MapReportManager_1060(30502): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
I/HmsMapKit_MapReportManager_1060(30502): ,errorCode: 999999
I/HiAnalytics/event(30502): [2020-09-07 16:12:38.772 I/hianalytics/HiAnalytics/event 30502:1 :50] HiAnalyticsInstance.onReport() is execute.TAG: hms_map,TYPE: 1
I/HiAnalytics/event(30502): [2020-09-07 16:12:38.773 I/hianalytics/HiAnalytics/event 30502:1 null:45] onReport: Before calling runtaskhandler()
I/HmsMapKit_MapTracker_50(30502): onReport end
I/HmsMapKit_MapReportManager_50(30502): report log success.
I/HmsMapKit_CrashHandler_136(30502): manual action --
I/HiAnalytics/event(30502): [2020-09-07 16:12:38.784 I/hianalytics/HiAnalytics/event 30502:1591 ThreadPoolExecutor.java:1187] run report.TAG : hms_map,TYPE: maint
W/ActionData(30502): [2020-09-07 16:12:38.791 W/hianalytics/ActionData 30502:1591 null:0] No data from cache sp!
I/SharedPreferenceUtil(30502): [2020-09-07 16:12:38.795 I/hianalytics/SharedPreferenceUtil 30502:1591 null:6] clear data file : eventTag : hms_map-maint
I/.herdhrpersona(30502): Background concurrent copying GC freed 51318(3MB) AllocSpace objects, 62(17MB) LOS objects, 50% free, 9MB/19MB, paused 931us total 116.283ms
W/System (30502): A resource failed to call release.
I/Process (30502): Sending signal. PID: 30502 SIG: 9
Lost connection to device.
Exited (sigterm)