Binary XML file line #0: Error inflating class com.amap.api.maps.MapView 高德地图

错误描述:

      Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.amap.api.maps.MapView
                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:545)
                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
                                                                       at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:436)
                                                                       at android.app.Activity.setContentView(Activity.java:2205)
                                                                       at com.wcyq.gangrong.ui.activity.AmapActivity.onCreate(AmapActivity.java:17)
                                                                       at android.app.Activity.performCreate(Activity.java:6285)
                                                                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
                                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
                                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2698) 
                                                                       at android.app.ActivityThread.access$1000(ActivityThread.java:195) 
                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1533) 
                                                                       at android.os.Handler.dispatchMessage(Handler.java:111) 
                                                                       at android.os.Looper.loop(Looper.java:207) 
                                                                       at android.app.ActivityThread.main(ActivityThread.java:5856) 
                                                                       at java.lang.reflect.Method.invoke(Native Method) 
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1026) 
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:887) 
                                                                    Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.amap.api.maps.MapView

原因以及解决办法:

原来我的xml中的代码是直接复制的,里面用的高德地图类是com.amap.api.maps.MapView,但是我只导入了2D的jar包,所以只有

com.amap.api.maps2d.MapView类
吧xml中使用的map view改为2D库的map view就好了。

你可能感兴趣的:(安卓Bug)