2013-02-16 55 views
0

我已經下載了谷歌API和現在有什麼似乎是我的地圖XML的標準問題是隻顯示一個灰色握在谷歌地圖應顯示,如下所示:沒有地圖顯示上MapActivity

enter image description here

我已經嘗試了兩個API密鑰(通過生成一個新的)無濟於事。我已經加入了互聯網許可,谷歌在我的清單映射庫,如下所示:

清單:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.example.map" 
android:versionCode="1" 
android:versionName="1.0" > 

<uses-sdk android:minSdkVersion="8" /> 

<uses-permission android:name="android.permission.INTERNET"/> 

<application 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" > 

    <activity 
     android:name=".MainMap" 
     android:label="@string/app_name" > 
     <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" /> 
</application> 
</manifest> 

API密鑰:

enter image description here

這是我的地圖XML佈局:

<?xml version="1.0" encoding="utf-8"?> 

<com.google.android.maps.MapView 
    android:id="@+id/mapView" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:enabled="true" 
    android:clickable="true" 
    android:apiKey="AIzaSyBV_Zio-pysGWfjGo7dUpGvYRZ9PB3NQLc"/> 

</RelativeLayout> 

我將我的項目設置爲Google API的SDK版本,與我的AVD一樣。

當我的應用程序加載和我的意圖開始,我得到的錯誤在我的控制檯:

02-16 15:55:04.637: E/MapActivity(305): Couldn't get connection factory client 
+1

閱讀[this](http://samir-mangroliya.blogspot.in/p/android-map-api-key.html)並生成API key [here](https://developers.google。 – 2013-02-16 16:19:43

+0

XML應用程序不能在應用程序的XML中使用 – JustinDanielson 2013-02-16 16:34:12

+0

您試圖做的這些方法在2012年12月被折舊:請閱讀[this文件(https://developers.google.com/maps/documentation/android/v1/)。即使您使用新的Google Maps API v2,也無法在模擬器中部署您的應用程序:請參閱[本文檔](http://developer.android.com/intl/ko/google/play-services/setup。 html) – BBonDoo 2013-02-23 02:08:07

回答

1

我認爲你的清單和佈局文件都可以。這個問題通常是由於關鍵問題引起的。通過使用SHA1證書指紋,我得到了同樣的問題。所以我去了MD5證書指紋。去這個網站https://developers.google.com/maps/documentation/android/v1/maps-api-signup並給你的MD5指紋並獲得鑰匙。獲得MD5指紋

  1. 通過在運行中鍵入cmd來打開命令提示符。開始⇒運行⇒ 鍵入cmd
  2. 轉到JDK的鍵入CD C bin目錄:\路徑到JDK-DIR \ BIN \

    在我的情況我輸入CD C:\ Program Files文件\的Java \ jdk1.7.0_07 \ BIN \

  3. 然後輸入密鑰工具-exportcert -alias androiddebugkey -keystore 「C:\用戶\用戶名\ .android \ debug.keystore」 -list -v

    在我我輸入keytool -exportcert -alias androiddebugkey -keystore「C:\ Users \ User \ .android \ debug.keystore」-list -v

  4. 然後您將被要求輸入密碼。默認密碼是android。

最後你會得到MD5指紋。

0

我有同樣的問題,在模擬器採用Android 2.3.3,並同時尋求解決方案我已經搜索發現這是該OS版本的模擬器的已知問題。只需嘗試其他版本的模擬器,它應該可以工作。希望這可以幫助。