在
public class MyLocationListener implements BDLocationListener {
@Override
public void onReceiveLocation(BDLocation location) {
if(location!=null){
this.location=location;
中添加
//错误代码,如果定位失败会返回这样的经纬度[4.9E-324, 4.9E-324]
if(62==location.getLocType()||63==location.getLocType()||67==location.getLocType()||(161<location.getLocType() && location.getLocType()<168)){this.location=null;
}
定位失败,location对象没有意义。
如果一直失败,换手机试试