2012-05-09 74 views
1

我試圖做一個樣品地圖應用程序,但地圖沒有出現在屏幕上,像這樣:Android的地圖不顯示

Map on my screen

我下面這個example,但我不不明白什麼是錯的,所以我的地圖看起來像這樣?

我已經添加了API密鑰是這樣的:

keytool -list -alias androiddebugkey -keystore debug.keystore \ 
     -storepass android -keypass android 

所有的GPS和互聯網的權限,並且將設備連接到互聯網。

+0

檢查您的LogCat - 最有可能的,那裏有一個錯誤,表明您用來簽署應用程序的密鑰沒有在谷歌註冊。 –

+0

遵循此示例http://developer.android.com/resources/tutorials/views/hello-mapview.html – KMI

+0

請參閱此完整示例http://android-example-code.blogspot.in/p/map-api- in-android.html – MAC

回答

5

或者:

  • 你打錯android:apiKey,或

  • 你沒有INTERNET權限,或者

  • 您的設備或仿真器不能訪問互聯網

    或者,爲地圖和檢查創建新的apikey。

0

see this完整的例子整理出來

還添加以下代碼mains.xml

<com.google.android.maps.MapView 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/mapview" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:apiKey="----YOUR KEY----" 
     android:clickable="true" /> 
0

調試時,出口時,它可能比你所簽署的APK用不同的證書。因此,您必須擁有兩個來自Google的API密鑰,或者您必須使用相同的證書對其進行簽名,否則不會使用正確的證書哈希生成apikey。

0

使用服務器API密鑰而不是android API密鑰。