在Android的谷歌地图蓝屏

问题描述 投票:3回答:4

我得到一个蓝屏当我加载Android上我的谷歌地图。我不知道我做错了,这是我得到的位置代码:

MapView mapView = (MapView) findViewById(R.id.mapDire);
Route route = directions(new GeoPoint((int)(2*1E6),(int)(34*1E6)),
  new GeoPoint((int)(3*1E6),(int)(36*1E6)));
android google-maps
4个回答
13
投票

我觉得可能是两件事情

  • 你的坐标是0,0和地图在开放的海洋
  • 出错了API密钥

在第一种情况下,尝试缩小了很多次,并尝试看到一些大陆。

在第二个尝试读取文件或/和尝试这个link

我希望这有帮助。


1
投票

我在我的应用程序有这个问题,看看下面的代码onlocationchanged方法和解决问题。

LatLng myCoordinates = new LatLng(location.getLatitude(), location.getLongitude());
         mMap.moveCamera(CameraUpdateFactory.newLatLng(myCoordinates));

    mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()), 17.0f));

    marker.setPosition(myCoordinates);

0
投票

通常蓝屏意味着您的谷歌API密钥不工作。

GoogleMaps - Actual Map not showing


0
投票

如果地图没有显示,只有网格/白屏显示,那是因为你的地图API密钥缺失或不正确。注册为谷歌Android地图API。

试试这个the link获取更多信息。

© www.soinside.com 2019 - 2024. All rights reserved.