Android 代号为 1 的设备上的 LayeredLayout 中未显示本机地图

Native map not shown in LayeredLayout on Android device with Codename One

2-3 周以来,我一直在真实的 Android 设备上使用我的应用程序进行开发。到目前为止,它总是在设备上显示 Google 地图,在模拟器上显示 OSM。

今天我做了一些更改——即在地图顶部添加了一个按钮,并发送了构建。 CN1 和 CN1libs 在发送构建之前已更新。现在,当我在设备上测试时,没有显示地图,我得到 404: Not found。如果您曾经询问过模拟器中的行为,它仍然可以按预期工作(但它使用带有 MapComponent 的 OSM)。

这是我放置地图的代码(地图初始化没有改变):

Container mapWithButton = LayeredLayout.encloseIn(BorderLayout.centerCenter(googleMap),
FlowLayout.encloseRight(locateMeButton));
this.add(BorderLayout.CENTER, mapWithButton);

我看过 MapContainer history,但最近的更改只涉及 longPressListener。请注意,本机地图应用程序在设备上运行良好。通过 DDMS 调试没有帮助(屏幕上出现相同的错误)。

我是不是忘记更新或添加构建提示了?

感谢任何帮助。

最终 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);