我知道這個問題之前已經被問及回答,但在按照所有說明操作之後,我仍然遇到同樣的問題:我的Android應用程序中有一個MapView,但視圖僅顯示底層網格(和覆蓋),但不是地圖本身。Android谷歌地圖不顯示
我在Eclipse中構建項目,如果這有所作爲。
我有以下的AndroidManifest.xml文件
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapplication"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".MyApplication"
android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="com.google.android.maps"></uses-library>
然後在我的殼,我跑以下命令: $ keytool -list -alias androiddebugkey -keystore ~/.android/debug.keystore -storepass android -keypass android
,並得到了以下的輸出: androiddebugkey, Sep 23, 2010, PrivateKeyEntry, Certificate fingerprint (MD5): DF:69:80:83:16:1A:F0:E9:B9:07:B9:BD:F7:BC:DB:61
我去了http://code.google.com/android/maps-api-signup.html並將值DF:69:80:83:16:1A:F0:E9:B9:07:B9:BD:F7:BC:DB:61
填入表格中,並得到以下API密鑰:0peT6kQ21Tpd1Rs61gBHHtquJwDcNeKkqedT08g
。
我RES /佈局/ main.xml中的文件看起來是這樣的:
<com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="true" android:apiKey="0peT6kQ21Tpd1Rs61gBHHtquJwDcNeKkqedT08g" />
而且我MyApplication.java文件看起來像: 包com.example.myapplication;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
public class MyApplication extends MapActivity {
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override protected boolean isRouteDisplayed() {
return false;
}
}
我部署使用Eclipse的項目,我的AVD與谷歌API 2.1 UPDATE1兼容。我檢查,以確保該項目的簽署,並$ jarsigner -verify -verbose ~/workspace/MyApplication/bin/MyApplication.apk
返回下面的輸出命令:
sm 2200 Thu Sep 30 12:42:16 EDT 2010 res/drawable/icon.png sm 676 Thu Sep 30 12:42:16 EDT 2010 res/layout/main.xml sm 1796 Thu Sep 30 12:42:16 EDT 2010 AndroidManifest.xml sm 1968 Thu Sep 30 12:42:16 EDT 2010 resources.arsc sm 7816 Thu Sep 30 12:42:16 EDT 2010 classes.dex 646 Thu Sep 30 12:42:16 EDT 2010 META-INF/MANIFEST.MF 699 Thu Sep 30 12:42:16 EDT 2010 META-INF/CERT.SF 776 Thu Sep 30 12:42:16 EDT 2010 META-INF/CERT.RSA s = signature was verified m = entry is listed in manifest k = at least one certificate was found in keystore i = at least one certificate was found in identity scope
我給的AVD的應用大約有10分鐘時間來加載地圖圖像和我沒有變任何東西。該adb logcat
沒有報告任何異常:
I/ActivityManager( 56): Starting activity: Intent { cmp=com.example.myapplication/.MyApplication } E/ActivityThread( 259): Failed to find provider info for com.google.settings E/ActivityThread( 259): Failed to find provider info for com.google.settings W/MapActivity( 259): Recycling dispatcher [email protected] V/MapActivity( 259): Recycling map object. I/ActivityManager( 56): Displayed activity com.example.myapplication/.MyApplication: 376 ms (total 376 ms)
任何人都可以找出我在做什麼錯在這裏?任何意見,將不勝感激。謝謝。
您是否使用Google API版本運行模擬器,而不是正常版本?你的模擬器有互聯網連接嗎?谷歌地圖應用程序的工作? – Falmarri 2010-09-30 17:26:20
是的,這是Google API,而不是普通版本。我不確定如何測試AVD的互聯網連接。但我看了一下地圖應用程序 - 一些地圖被加載。如果我滾動瀏覽地圖,我會看到地圖,但是如果我向上,向下,向左或向右滾動得太遠,我只能看到下面的網格(它不會加載地圖的其餘部分)。 – jay 2010-09-30 17:42:40