Javier Delgado
Javier Delgado

Reputation: 2383

Crash in Huawei Map Kit: MapsCore is not initialized

I am trying to implement the Huawei Map Kit in one of my apps.

I can load the map correctly an even draw some markers. It is a single activity application with several fragments.

I can navigate correctly to the map, but when I change to any other fragment, I always get this error:

error,    02-08 22:27:50.745,   11278,   11278,    StatusFragment,    onResume StatusFragment
error,    02-08 22:27:50.747,   11278,   11278,    MapFragment,    onPause MapFragment
error,    02-08 22:27:50.747,   11278,   11278,    MapFragment,    onStop MapFragment
error,    02-08 22:27:50.928,   11278,   11278,    MapFragment,    onDestroy MapFragment
debug,    02-08 22:27:50.965,   11278,   11278,    AndroidRuntime,    Shutting down VM
error,    02-08 22:27:50.967,   11278,   11278,    AndroidRuntime,    FATAL EXCEPTION: main
warn,    02-08 22:27:50.967,   11278,   13410,    System.err,    java.lang.Error: MapsCore is not initialized
warn,    02-08 22:27:50.967,   11278,   13410,    System.err,       at com.tomtom.core.maps.NativeMapViewImpl.nativeRender(Native Method)
warn,    02-08 22:27:50.967,   11278,   13410,    System.err,       at com.tomtom.core.maps.NativeMapViewImpl.render(:103)
warn,    02-08 22:27:50.968,   11278,   13410,    System.err,       at o.pI.a(Unknown Source:2)
warn,    02-08 22:27:50.968,   11278,   13410,    System.err,       at com.tomtom.online.sdk.map.MapView.doFrame(Unknown Source:0)
warn,    02-08 22:27:50.968,   11278,   13410,    System.err,       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1055)
warn,    02-08 22:27:50.968,   11278,   13410,    System.err,       at android.view.Choreographer.doCallbacks(Choreographer.java:875)
warn,    02-08 22:27:50.968,   11278,   13410,    System.err,       at android.view.Choreographer.doFrame(Choreographer.java:772)
warn,    02-08 22:27:50.968,   11278,   13410,    System.err,       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1042)
warn,    02-08 22:27:50.968,   11278,   13410,    System.err,       at android.os.Handler.handleCallback(Handler.java:888)
warn,    02-08 22:27:50.968,   11278,   13410,    System.err,       at android.os.Handler.dispatchMessage(Handler.java:100)
warn,    02-08 22:27:50.968,   11278,   13410,    System.err,       at android.os.Looper.loop(Looper.java:213)
warn,    02-08 22:27:50.968,   11278,   13410,    System.err,       at android.app.ActivityThread.main(ActivityThread.java:8147)
warn,    02-08 22:27:50.968,   11278,   13410,    System.err,       at java.lang.reflect.Method.invoke(Native Method)
warn,    02-08 22:27:50.968,   11278,   13410,    System.err,       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
warn,    02-08 22:27:50.968,   11278,   13410,    System.err,       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)

I am using the latest version Maps Kit: com.huawei.hms:maps:4.0.0.301

Did you have the same issue?

Upvotes: 0

Views: 895

Answers (2)

Victor
Victor

Reputation: 19

It is very likely that the life cycle of map is not properly managed. The onDestory() of map should be called inside the onDestory() of activity.

Upvotes: 0

klcmin
klcmin

Reputation: 66

as a workaround, you can remove onDestroy() method from mapfragment if you use.

Upvotes: 1

Related Questions