我做了这个例子http://mobisys.in/blog/2012/12/google-rolls-out-android-maps-api-v2/,但没有出现在我的设备中的地图
这是我的 AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.control_guard"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="15"/>
<permission
android:name="com.control_guard.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="com.control_guard.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" >
</uses-permission>
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".Inicio"
android:label="@string/title_activity_inicio"
android:theme="@android:style/Theme.Holo.NoActionBar"
android:uiOptions="splitActionBarWhenNarrow">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="Login"
android:theme="@android:style/Theme.Holo.NoActionBar" >
</activity>
<activity android:name="MenuControlGuard" >
</activity>
<activity android:name="MenuPrincipal" >
</activity>
<activity android:name="Asistencia"
android:theme="@android:color/holo_blue_dark">
</activity>
<activity android:name="ListaPersonal"
android:theme="@android:color/holo_blue_dark" >
</activity>
<activity
android:name=".DatosPersonal"
android:label="@string/title_activity_datos_personal" >
</activity>
<activity
android:name=".ListaClientes"
android:label="@string/title_activity_lista__clientes"
android:theme="@android:color/holo_blue_dark">
</activity>
<activity
android:name=".DatosCliente"
android:label="@string/title_activity_datos_cliente" >
</activity>
<activity
android:name=".MenuReportes"
android:label="@string/title_activity_menu_reportes" >
</activity>
<activity
android:name=".NuevoReporte"
android:label="@string/title_activity_nuevo_reporte" >
</activity>
<activity
android:name=".Lista_Reportes"
android:label="@string/title_activity_lista__reportes"
android:theme="@android:color/holo_blue_dark" >
</activity>
<activity
android:name=".EditarReporte"
android:label="@string/title_activity_editar_reporte" >
</activity>
<activity
android:name=".MenuPrincipalOperaciones"
android:label="@string/title_activity_menu_principal_operaciones" >
</activity>
<activity
android:name=".VerReportes"
android:label="@string/title_activity_ver_reportes" >
</activity>
<activity
android:name=".ListaSupervisor"
android:label="@string/title_activity_lista_supervisor"
android:theme="@android:color/holo_blue_dark" >
</activity>
<activity
android:name=".Mapa"
android:label="@string/title_activity_mapa" >
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyAUvGf-KcrLy4ptevrE5LRK9XCVuYf7vOE" />
</application>
`
我的 .xml 是
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment" />`
这是我的 .java
package com.control_guard;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
public class Mapa extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mapa);
final LatLng HAMBURG = new LatLng(53.558, 9.927);
final LatLng KIEL = new LatLng(53.551, 9.993);
final GoogleMap map;
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
Marker hamburg = map.addMarker(new MarkerOptions().position(HAMBURG)
.title("Hamburg"));
Marker kiel = map.addMarker(new MarkerOptions()
.position(KIEL)
.title("Kiel")
.snippet("Kiel is cool")
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.ic_launcher)));
// Move the camera instantly to hamburg with a zoom of 15.
map.moveCamera(CameraUpdateFactory.newLatLngZoom(HAMBURG, 15));
// Zoom in, animating the camera.
map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.mapa, menu);
return true;
}`
请我在这个问题上需要帮助,我没有在我的代码中找到错误。