2011-03-23 74 views
0

我試圖讓GoogleMaps顯示在模擬器或我的Android設備上。無法讓GoogleMaps在Android上顯示

我已經經歷了一切關於這個在互聯網上,有沒有運氣

佈局 - main.xml中有apiKey我debug.keystore

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 
<TextView 
    android:id="@+id/myLocationText" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello" 
/> 
<com.google.android.maps.MapView 
    android:id="@+id/myMapView" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:enabled="true" 
    android:clickable="true" 
    **android:apiKey="0QVYGuX4_0vLI8Uro3uUP3GYvG539JlObdsXxHA"** 
/> 
</LinearLayout> 

該清單包括INTERNET和ACCESS_FINE_LOCATION權限

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="jt.com.whereami"> 
<application 
android:icon="@drawable/icon"> 
<uses-library android:name="com.google.android.maps"/> 
<activity 
android:name=".WhereAmI" 
android:label="@string/app_name"> 
<intent-filter> 
<action android:name="android.intent.action.MAIN" /> 
<category android:name="android.intent.category.LAUNCHER" /> 
</intent-filter> 
</activity> 
</application> 
<uses-permission android:name="android.permission.INTERNET"/> 
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> 
<uses-sdk android:minSdkVersion="7" /> 
</manifest> 

地圖顯示出來,但只顯示框。

我使用Eclipse來開發,一切正常。

有什麼我失蹤了嗎?

+0

調試鍵唯一作品使用debug.keystore,確保您正在運行應用程序,方法是右鍵單擊項目並選擇debug作爲android。如果密鑰錯誤,logcat中應該有與獲取地圖圖塊有關的例外情況。 – 2011-03-23 20:40:31

+0

相同的東西.. Logcat中關於錯誤的內容不存在 調試爲android在模擬器和設備上都具有相同的結果。 – Bikeaccdnt 2011-03-23 20:58:40

+0

您的.WhereAmI.java類擴展了MapActivity? – 2011-03-23 23:24:42

回答

0

至於你說的「的地圖上顯示了,但只顯示框」 means..i經歷過類似問題......只有十字線出現在屏幕上......

這是因爲放大的level..U應該爲mapview設置縮放大約10個左右...... !!

希望這有助於..

+0

謝謝,但我已經嘗試低縮放級別,高縮放級別。同樣的結果 – Bikeaccdnt 2011-03-24 12:16:07

0

apiKey我debug.keystore

關鍵調試地圖API;如果你想看Map,你必須直接從IDE安裝(例如:從Eclipse安裝)。這臺電腦是用來創造MD5和獲取地圖API 每個PC有一個MD5獨特

apiKey爲publicication:必須從文件的apk安裝應用程序,即可查看地圖