我无法启动活动ComponentInfo

时间:2013-11-20 14:27:27

标签: android google-play fragment android-support-library

我的应用程序在线崩溃

setContentView(R.layout.activity_map);

我正在使用谷歌地图api v2,我曾经在以前的eclipse和android sdk上运行这个应用程序,它运行,重新安装android sdk后,得到了这个异常

11-20 16:26:28.494: E/AndroidRuntime(19705): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.poputkaonline/com.example.poputkaonline.MapActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
11-20 16:26:28.494: E/AndroidRuntime(19705):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2355)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2391)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at android.app.ActivityThread.access$600(ActivityThread.java:151)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1335)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at android.os.Looper.loop(Looper.java:155)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at android.app.ActivityThread.main(ActivityThread.java:5520)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at java.lang.reflect.Method.invokeNative(Native Method)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at java.lang.reflect.Method.invoke(Method.java:511)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:796)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at dalvik.system.NativeStart.main(Native Method)
11-20 16:26:28.494: E/AndroidRuntime(19705): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
11-20 16:26:28.494: E/AndroidRuntime(19705):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:324)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at android.app.Activity.setContentView(Activity.java:1912)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at com.example.poputkaonline.MapActivity.onCreate(MapActivity.java:263)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at android.app.Activity.performCreate(Activity.java:5066)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1101)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2311)
11-20 16:26:28.494: E/AndroidRuntime(19705):    ... 11 more
11-20 16:26:28.494: E/AndroidRuntime(19705): 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 <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
11-20 16:26:28.494: E/AndroidRuntime(19705):    at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at com.google.android.gms.maps.internal.q.v(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at com.google.android.gms.maps.internal.q.u(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at com.google.android.gms.maps.SupportMapFragment$b.cE(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at com.google.android.gms.dynamic.a.a(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:269)
11-20 16:26:28.494: E/AndroidRuntime(19705):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)

2 个答案:

答案 0 :(得分:1)

尝试添加Google Play服务作为您项目的参考...

甚至添加androidmanifest.xml

 <meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

答案 1 :(得分:0)

解释在你的堆栈跟踪中:

  

引起:java.lang.IllegalStateException:您的元数据标记   应用程序的AndroidManifest.xml没有正确的值。预期   4030500但找到0.您必须在其中包含以下声明   <application>元素:<meta-data android:name="com.google.android.gms.version"android:value="@integer/google_play_services_version" />