集成百度地图街景时,看官方的demo发现需要如下初始化动作。
public void initEngineManager(Context context) {
if (mBMapManager == null) {
mBMapManager = new BMapManager(context);
}
if (!mBMapManager.init(new MyGeneralListener())) {
Toast.makeText(PanoDemoApplication.getInstance().getApplicationContext(), "BMapManager 初始化错误!",
Toast.LENGTH_LONG).show();
}
Log.d("ljx", "initEngineManager");
}
E/global exception:: android.view.InflateException: Binary XML file line #156 in com.xxx.common:layout/home_fragment_main: Binary XML file line #156 in com.xxx.common:layout/home_fragment_main: Error inflating class com.baidu.lbsapi.panoramaview.PanoramaView
Caused by: android.view.InflateException: Binary XML file line #156 in com.boer.common:layout/home_fragment_main: Error inflating class com.baidu.lbsapi.panoramaview.PanoramaView
Caused by: java.lang.reflect.InvocationTargetException
引入组件时报错了。这个类可以引入进来,说明依赖多半没问题,进入SDK的PanoramaView类看了一下,发现BMapManager是在lbsapi包下的,跟其他sdk有相同类名,粗心了老铁,重新初始化一下,好了。