开发日志03

今天完成了地图定位,并且将自己当前的位置显示到画面的中央

效果图:

用时:4个小时

 

遇到的问题:

1.当我点击run后,Androidstudio的控制台直接弹出了错误,以前也没有遇到过这个错误

Cause: unable to find valid certification path to requested target

解决办法:

https://www.cnblogs.com/022414ls/p/13440545.html

2. java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.express_delivery/com.example.express_delivery.MainActivity}: java.lang.InstantiationException: java.lang.Class<com.example.express_delivery.MainActivity> has no zero argument constructor

并且软件进入后直接闪屏退出

其错误图:

 

 

我上网搜了很多,他们的问题大都和我的不一样

参考博客:

https://blog.csdn.net/dukongjian/article/details/87385491

https://www.cnblogs.com/z1141000271/p/7905912.html

https://blog.csdn.net/disanxiaoyao/article/details/80047737?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param

https://blog.csdn.net/cshichao/article/details/9979621?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param

 

其他的我就不写了,因为我看过之后,问题前半部分一样,但是后面不一样了就,(当然我也按着他们的来了一下,还是会出问题)于是我就接着检查和官方给的步骤,哪不一样,

后来发现当时写的时候,有一点是不太明白

 

这句话中的mBaiduMap是怎么来的,我就又上网搜了搜(还看了看以前搜的百度地图定位的案例代码),后来终于找到了

1.首先是需要在代码的开始,定义一下

 

2.然后获取地图层

 

然后才能使用他,完成我刚才不确定的那段代码

//开启地图的定位图层
mBaiduMap.setMyLocationEnabled(true);

 

posted @ 2020-08-04 21:08  谜语+  阅读(147)  评论(0)    收藏  举报