1

即使我在 Google Play 服务示例中使用 mapdemo 项目,Google 地图 API V2 仍显示空白屏幕

  • 我重新安装了谷歌播放服务 SDK。
  • 我更改了 API 密钥
  • 我更改了 debug.keystore 并重新生成了 sha1 指纹

没有改变...

并且mMap总是结果为空?

if (mMap == null) { 
// Try to obtain the map from the SupportMapFragment. 
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)) .getMap(); 
// Check if we were successful in obtaining the map. 
if (mMap != null) { 
setUpMap(); 
}
4

3 回答 3

1

这个问题(带缩放控制的空白地图)通常源于您没有google-play-services正确引用库,或者没有在控制台中正确配置 API。

您可以查看我写的关于如何在您的应用程序中集成 Google Maps API V2 的这篇博文:

谷歌地图 API V2

按照前 3 个步骤进行正确的google-play-services库集成。

或者在 API 控制台中查看这篇文章以获得正确的配置:

谷歌地图 API V2 密钥

于 2013-05-21T13:33:05.017 回答
0

实际上我发现设备操作系统只能处理地图视图而不是地图片段。

于 2013-07-20T21:45:04.230 回答
0

您的地图是否显示放大标志?

编辑: 试试这样..我也有和你一样的问题..碰巧解决了如下

android.support.v4.app.FragmentManager myFragmentManager = getSupportFragmentManager();
    SupportMapFragment mySupportMapFragment = (SupportMapFragment) myFragmentManager
            .findFragmentById(R.id.map);
    googleMap = mySupportMapFragment.getMap();
于 2013-05-21T13:18:20.793 回答