开发百度地图过程中,使用模拟器报如下错误:
Process: , PID: 2544
java.lang.IllegalArgumentException: No config chosen
at android.opengl.GLSurfaceView$BaseConfigChooser.chooseConfig(GLSurfaceView.java:869)
at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:1023)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1400)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)
异常的原因是SDK找不到支持OPENGL的硬件。
解决办法:将MapView换成
TextureMapView。
代码如下:
修改前:
<com.baidu.mapapi.map.MapView
android:id="@+id/bmapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true" />
修改后:
<com.baidu.mapapi.map.TextureMapView
android:id="@+id/bmapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true" />
问题解决!
但是使用TextureMapView会出现另外一个问题,按home键,在切回程序后,会变成下图的效果。
所以,使用模拟器开发的时候用
TextureMapView,打包在真机上运行的时候还是用MapView吧!