Android google maps v2在启动时崩溃

在我支持2.2及更高版本的Android应用程序中,我正在尝试使用google maps api v2。

到目前为止我有这个:

有谁知道这是什么问题?

谢谢。

XML

   

java的

 import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.SupportMapFragment; import android.location.Geocoder; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.view.Menu; public class Activity_Map extends FragmentActivity { GoogleMap map = null; Geocoder coder; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map); map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); coder = new Geocoder(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_map, menu); return true; } } 

表现

                          

CRASH LOG

 12-29 22:44:58.103: E/AndroidRuntime(7331): FATAL EXCEPTION: main 12-29 22:44:58.103: E/AndroidRuntime(7331): java.lang.RuntimeException: Unable to start activity ComponentInfo{sord.ids_connect/sord.ids_connect.Activity_Map}: android.view.InflateException: Binary XML file line #11: Error inflating class fragment 12-29 22:44:58.103: E/AndroidRuntime(7331): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110) 12-29 22:44:58.103: E/AndroidRuntime(7331): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135) 12-29 22:44:58.103: E/AndroidRuntime(7331): at android.app.ActivityThread.access$700(ActivityThread.java:143) 12-29 22:44:58.103: E/AndroidRuntime(7331): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241) 12-29 22:44:58.103: E/AndroidRuntime(7331): at android.os.Handler.dispatchMessage(Handler.java:99) 12-29 22:44:58.103: E/AndroidRuntime(7331): at android.os.Looper.loop(Looper.java:137) 12-29 22:44:58.103: E/AndroidRuntime(7331): at android.app.ActivityThread.main(ActivityThread.java:4950) 12-29 22:44:58.103: E/AndroidRuntime(7331): at java.lang.reflect.Method.invokeNative(Native Method) 12-29 22:44:58.103: E/AndroidRuntime(7331): at java.lang.reflect.Method.invoke(Method.java:511) 12-29 22:44:58.103: E/AndroidRuntime(7331): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004) 12-29 22:44:58.103: E/AndroidRuntime(7331): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771) 12-29 22:44:58.103: E/AndroidRuntime(7331): at dalvik.system.NativeStart.main(Native Method) 12-29 22:44:58.103: E/AndroidRuntime(7331): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class fragment 12-29 22:44:58.103: E/AndroidRuntime(7331): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 12-29 22:44:58.103: E/AndroidRuntime(7331): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 12-29 22:44:58.103: E/AndroidRuntime(7331): at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 12-29 22:44:58.103: E/AndroidRuntime(7331): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 12-29 22:44:58.103: E/AndroidRuntime(7331): at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 12-29 22:44:58.103: E/AndroidRuntime(7331): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:316) 12-29 22:44:58.103: E/AndroidRuntime(7331): at android.app.Activity.setContentView(Activity.java:1915) 12-29 22:44:58.103: E/AndroidRuntime(7331): at sord.ids_connect.Activity_Map.onCreate(Activity_Map.java:18) 12-29 22:44:58.103: E/AndroidRuntime(7331): at android.app.Activity.performCreate(Activity.java:5177) 12-29 22:44:58.103: E/AndroidRuntime(7331): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094) 12-29 22:44:58.103: E/AndroidRuntime(7331): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074) 12-29 22:44:58.103: E/AndroidRuntime(7331): ... 11 more 12-29 22:44:58.103: E/AndroidRuntime(7331): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4030500 but found 0. You must have the following declaration within the  element:  12-29 22:44:58.103: E/AndroidRuntime(7331): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source) 12-29 22:44:58.103: E/AndroidRuntime(7331): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source) 12-29 22:44:58.103: E/AndroidRuntime(7331): at com.google.android.gms.maps.internal.qv(Unknown Source) 12-29 22:44:58.103: E/AndroidRuntime(7331): at com.google.android.gms.maps.internal.qu(Unknown Source) 12-29 22:44:58.103: E/AndroidRuntime(7331): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source) 12-29 22:44:58.103: E/AndroidRuntime(7331): at com.google.android.gms.maps.SupportMapFragment$b.cE(Unknown Source) 12-29 22:44:58.103: E/AndroidRuntime(7331): at com.google.android.gms.maps.SupportMapFragment$ba(Unknown Source) 12-29 22:44:58.103: E/AndroidRuntime(7331): at com.google.android.gms.dynamic.aa(Unknown Source) 12-29 22:44:58.103: E/AndroidRuntime(7331): at com.google.android.gms.dynamic.a.onInflate(Unknown Source) 12-29 22:44:58.103: E/AndroidRuntime(7331): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source) 12-29 22:44:58.103: E/AndroidRuntime(7331): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:290) 12-29 22:44:58.103: E/AndroidRuntime(7331): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676) 12-29 22:44:58.103: E/AndroidRuntime(7331): ... 21 more 

将此添加到下的清单中

  

log-cat很清楚,它将问题确定为:

 java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4030500 but found 0. You must have the following declaration within the  element:  

告诉我它是否有效,编程愉快