Google Maps API v2 を使用する Android アプリケーションを作成しています。Googleチュートリアルのサイスとしてすべてを行ったと思いますが、それでもGoogleマップグリッドのみを取得しています(マップなし)。keystore.debug の SHA1 を使用してデバッグ キーを作成しました。
以下は私の設定です: Eclipse Java コンパイラ バージョン 1.7 Project Java コンパイラ バージョン 1.6
アプリケーション マニフェスト:
<manifest ...>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="my.app.test.permission.MAPS_RECEIVE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application>
<activity>
...
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="xxxxxxxxxxxxxxxxxxxxxxxxxx"/>
<uses-library android:name="com.google.android.maps"/>
</application>
</manifest>
マップ xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/BackGroundColor"
android:orientation="vertical"
tools:context=".test" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingRight="10dp"
android:paddingTop="5dp" >
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="xxxxxxxxxxxxxxxxxxxxxxxxxx" >
</com.google.android.maps.MapView>
</LinearLayout>
</LinearLayout>
マップ アクティビティ:
public class Map extends MapActivity {
MapView mapView;
MapController mc;
GeoPoint p;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_map);
mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
mapView.setStreetView(true);
mc = mapView.getController();
String coordinates[] = {"1.352566007", "103.78921587"};
double lat = Double.parseDouble(coordinates[0]);
double lng = Double.parseDouble(coordinates[1]);
p = new GeoPoint(
(int) (lat * 1E6),
(int) (lng * 1E6));
mc.animateTo(p);
mc.setZoom(17);
mapView.invalidate();
}
@Override
protected boolean isRouteDisplayed() { return false; }
}
同じ問題を抱えた投稿がたくさんあることを私は知っています。全部読みました!!!キーを数回作成しましたが、それでも同じです...何が間違っていて、グリッドしか表示されていないのでしょうか? アプリケーションは、Android バージョン 2.2.1 を搭載した Samsung モバイルだけでなく、AVD に対しても同じ結果をもたらします。