【发布时间】:2011-12-02 03:51:24
【问题描述】:
我在标签中查看了地图,直到今天它都运行良好。请记住,自从我开始工作以来,我已经触及了地图视图中的任何代码。突然之间,地图视图上不再显示任何内容,只是地图网格。什么会导致这种情况?我尝试了一个新的 API 密钥,但它似乎不起作用。谷歌地图加载一切正常。我什至在其他手机上尝试过,仍然只是一个网格。
地图类
package com.nyneaxis.api.gascloud;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import android.os.Bundle;
import android.widget.LinearLayout;
public class StationsMap extends MapActivity {
LinearLayout linearLayout;
MapView mapView;
public void onCreate(Bundle savedInstanceState){
mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
maps.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainlayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.google.android.maps.MapView
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="ABQIAAAAYc7mzgA4G-2FaBLUHTM_1xTjBItGPNb7O-Zq4IGUb6RxSdEi4RQ7Y-p4UARzkmuBTxknyrJRWOA31w"
/>
</RelativeLayout>
【问题讨论】:
-
我认为你的 api 密钥是错误的。
-
我只是比较了api密钥长度,你的api密钥太长了。我的 api 密钥是 0bBgLl42nWwnTf983Y5VdIgfZI6mC7meL7Ms_qg 。我只是猜测,
-
尝试了不同的/新的 API,但仍然没有。只是一个简单的网格!这是 Google 为我生成的 API。
-
再次尝试生成密钥使用 keytool -list -alias androiddebugkey -keystore "C:\Users\pc.android\debug.keystore" -storepass android -keypass android 你可以找到路径 "C :\...." 在 Eclipse 窗口->首选项->android->build.
标签: android google-maps maps