私はGoogleマップに基づいてAndroidでアプリケーションを作成しました。APIキーを取得し、エミュレーターで正常に実行されていますが、デバイスで実行すると、強制終了メッセージが表示されます。誰かがデバイスで使用するためのAPIキーを取得する方法と、デバイス専用のAPIキーを取得する必要があるかどうかを説明できますか?
私のJavaコード:
setContentView(R.layout.mapview);
mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
String coordinates[] = {"9.966667", "78.166667"};
double lat = Double.parseDouble(coordinates[0]);
double lng = Double.parseDouble(coordinates[1]);
GeoPoint p = new GeoPoint((int) (lat * 1E6),(int) (lng * 1E6));
MapController mapController = mapView.getController();
mapController.setCenter(p);
mapController.animateTo(p);
mapController.setZoom(12);
私のレイアウト:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.google.android.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="myapikey" />
</LinearLayout>
Logcatエラー:
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x1080215
この問題は私のプロジェクトの妨げになっているため、修正されるまで先に進むことができません。