SKMapsInitializationException Skobbler?

时间:2016-11-27 12:03:22

标签: android skmaps skobbler-maps

我使用的是skobbler android studio的样本。

当我点击地图链接(由Scout | OSM提供支持)时,我会重定向到网络浏览器,但是当我回到崩溃的时候!!!

我该怎么办?

FATAL EXCEPTION: main
        java.lang.RuntimeException: Unable to start activity ComponentInfo{........activity.MapActivity}: android.view.InflateException: Binary XML file line #25: Error inflating class com.skobbler.ngx.map.SKMapViewHolder
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2214)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2264)
            at android.app.ActivityThread.access$600(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1259)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5148)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
            at dalvik.system.NativeStart.main(Native Method)
         Caused by: android.view.InflateException: Binary XML file line #25: Error inflating class com.skobbler.ngx.map.SKMapViewHolder
            at android.view.LayoutInflater.createView(LayoutInflater.java:620)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
            at com.example.asheq.skobb_me_2.fragments.MapFragment.onCreateView(MapFragment.java:19)
            at android.app.Fragment.performCreateView(Fragment.java:1699)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:885)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1057)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1039)
            at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1840)
            at android.app.Activity.performCreate(Activity.java:5239)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2178)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2264) 
            at android.app.ActivityThread.access$600(ActivityThread.java:144) 
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1259) 
            at android.os.Handler.dispatchMessage(Handler.java:99) 
            at android.os.Looper.loop(Looper.java:137) 
            at android.app.ActivityThread.main(ActivityThread.java:5148) 
            at java.lang.reflect.Method.invokeNative(Native Method) 
            at java.lang.reflect.Method.invoke(Method.java:525) 
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
            at dalvik.system.NativeStart.main(Native Method) 
         Caused by: java.lang.reflect.InvocationTargetException
            at java.lang.reflect.Constructor.constructNative(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
            at android.view.LayoutInflater.createView(LayoutInflater.java:594)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
            at com.example.asheq.skobb_me_2.fragments.MapFragment.onCreateView(MapFragment.java:19) 
            at android.app.Fragment.performCreateView(Fragment.java:1699) 
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:885) 
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1057) 
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1039) 
            at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1840) 
            at android.app.Activity.performCreate(Activity.java:5239) 
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2178) 
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2264) 
            at android.app.ActivityThread.access$600(ActivityThread.java:144) 
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1259) 
            at android.os.Handler.dispatchMessage(Handler.java:99) 
            at android.os.Looper.loop(Looper.java:137) 
            at android.app.ActivityThread.main(ActivityThread.java:5148) 
            at java.lang.reflect.Method.invokeNative(Native Method) 
            at java.lang.reflect.Method.invoke(Method.java:525) 
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
            at dalvik.system.NativeStart.main(Native Method) 
         Caused by: com.skobbler.ngx.SKMapsInitializationException: SKMaps was not initialized. In order to initialize it, please call: SKMaps.getInstance().initializeSKMaps(context, mapInitSettings)
            at com.skobbler.ngx.map.SKMapViewHolder.<init>(SourceFile:144)
            at java.lang.reflect.Constructor.constructNative(Native Method) 
            at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 
            at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
            at com.example.asheq.skobb_me_2.fragments.MapFragment.onCreateView(MapFragment.java:19) 
            at android.app.Fragment.performCreateView(Fragment.java:1699) 
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:885) 
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1057) 
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1039) 
            at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1840) 
            at android.app.Activity.performCreate(Activity.java:5239) 
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2178) 
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2264) 
            at android.app.ActivityThread.access$600(ActivityThread.java:144) 
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1259) 
            at android.os.Handler.dispatchMessage(Handler.java:99) 
            at android.os.Looper.loop(Looper.java:137) 
            at android.app.ActivityThread.main(ActivityThread.java:5148) 
            at java.lang.reflect.Method.invokeNative(Native Method) 
            at java.lang.reflect.Method.invoke(Method.java:525) 
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
            at dalvik.system.NativeStart.main(Native Method) 

1 个答案:

答案 0 :(得分:3)

这个问题正在发生,因为在请求膨胀地图片段时,SKMaps库未初始化。

问题的解决方法,按此顺序尝试:

  1. 确保未选中手机的开发者选项Do not keep activities

  2. 在给地图片段膨胀之前检查库是否已初始化,以及是否未重新初始化它。

  3. 停止致电SKMaps.getInstance().destroySKMaps();