6月162010
0
Androidマーケットでのアプリの公開で書いた方法だけでは、Google Mapsを使っているアプリで地図が表示されなかった。
よく考えたら、MapViewのAPI Keyの指定はアプリのビルド時に使うkeystoreから作ったMD5 finger printから生成されていた。
MD5 fingerprintをAndroidマーケットでのアプリの公開で作ったリリース用の鍵から生成する。
keytool -list -keystore shokai-key
Sign Up for the Android Maps API – Android Maps API – Google Codeに、MD5 fingerprintをコピペして「Generate API Key」を押す
新しくAPI Keyが生成される。
Eclipseで、layout/main.xmlを編集。MapViewにapiKeyを指定
<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="your-api-key"
/>
これでEclipseでパッケージ名を右クリックして[Android Tools]→[Export Signed Application Package]でapkを生成して、Marketで公開する。
shokai.org で検索

既にdebug版アプリが入っていれば入れ替わる

AndroidManifest.xmlに基づいてインストール時に警告が出る

地図を使うアプリの作り方については、以前AndroidでGPSロガーでくわしく書いた。