申請google API Key

想使用google map api 必須從google網站上獲取key以後纔有權限使用,可是要想申請key必需要有證實書,也就是所謂的MD5.下面一步一步來講明:android

    步驟1api

若是你使用的是eclipse編寫android程序,那麼就打開eclipse->Windows→Preference→Android→Build,其中Default debug keystore的值即是debug.keystore的路徑,複製下來。eclipse

  步驟2網站

執行命令:keytool -list -keystore debug.keystore,這時可能會提示你輸入密碼,這裏輸入默認的密碼「android」,便可取得MD5值。ui

步驟3google

打開網頁:https://developers.google.com/maps/documentation/android/start#installing_the_google_maps_android_v2_api,(先登陸google帳號,沒有的話註冊個就行,這個問題不大吧。)點擊Creating an API Project,而後點擊 Google APIs Console.而後點擊左側欄的Servises,在右側出來的列表中往下翻,知道你找到Google Maps API v2,而後點擊那個開關,使其狀態爲開。spa

步驟4.debug

點擊左側欄的API Access,在右側出來的頁面中點擊Create new Android key,此時會彈出來一個頁面,在輸入框中輸入你以前獲得的認證書,格式是xxxxxxxxx;com.example, 這裏的com.example是你安卓工程中用的包名,而後點擊create後便生成對應的api key,複製key,而後在你的安卓工程的AndroidManifest.xml中添加key就好了,至於具體實現下次再說吧。code

相關文章
相關標籤/搜索