2-3周来,我一直在一个真正的Android设备上使用我的应用程序。到目前为止,它一直在设备上显示谷歌地图,在模拟器上显示OSM。
今天,我做了一些修改,-namely在地图上添加了一个按钮,并发送了构建。在发送构建之前更新了CN1和CN1libs。现在,当我在设备上测试它时,没有显示地图,我得到了404: Not 。如果您询问过模拟器中的行为,它仍然按预期工作(但它与MapComponent一起使用OSM )。
下面是放置映射的代码(映射初始化没有更改):
Container mapWithButton = LayeredLayout.encloseIn(BorderLayout.centerCenter(googleMap),
FlowLayout.encloseRight(locateMeButton));
this.add(BorderLayout.CENTER, mapWithButton);我看过MapContainer历史,但最近的变化只涉及到longPressListener。请注意,本机地图应用程序在设备上运行良好。通过DDMS进行调试没有帮助(屏幕上也出现了相同的错误)。
我忘记更新或添加构建提示了吗?
任何帮助都很感激。
发布于 2017-02-20 13:56:48
最终,404错误与映射无关,而是与添加的MapListener无关,后者试图从移动映射时不可用的地址获取数据。
然而,使地图实际出现的事实是,它需要通过BorderLayout.center()而不是BorderLayout.centerCenter()选项来封装它。
因此,我没有提供任何解释,但是下面的代码显示了地图和按钮(请注意BorderLayout.center而不是BorderLayout.centerCenter )。
Container mapWithButton = LayeredLayout.encloseIn(
BorderLayout.center(googleMap),
FlowLayout.encloseRight(locateMeButton));
this.add(BorderLayout.CENTER, mapWithButton);https://stackoverflow.com/questions/42332812
复制相似问题