不幸的是,应用程序已停止使用谷歌地图api v2

时间:2015-04-01 19:18:58

标签: android google-maps-android-api-2

这是我的日志文件

04-01 17:21:32.460: E/dalvikvm(296): Could not find class 'android.app.Notification$Builder', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
04-01 17:21:32.470: E/dalvikvm(296): Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
04-01 17:21:32.651: E/AndroidRuntime(296): FATAL EXCEPTION: main
04-01 17:21:32.651: E/AndroidRuntime(296): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tutos.android.gmapv2/com.tutos.android.gmapv2.MyMapActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-01 17:21:32.651: E/AndroidRuntime(296):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-01 17:21:32.651: E/AndroidRuntime(296):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-01 17:21:32.651: E/AndroidRuntime(296):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-01 17:21:32.651: E/AndroidRuntime(296):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-01 17:21:32.651: E/AndroidRuntime(296):  at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 17:21:32.651: E/AndroidRuntime(296):  at android.os.Looper.loop(Looper.java:123)
04-01 17:21:32.651: E/AndroidRuntime(296):  at android.app.ActivityThread.main(ActivityThread.java:4627)
04-01 17:21:32.651: E/AndroidRuntime(296):  at java.lang.reflect.Method.invokeNative(Native Method)
04-01 17:21:32.651: E/AndroidRuntime(296):  at java.lang.reflect.Method.invoke(Method.java:521)
04-01 17:21:32.651: E/AndroidRuntime(296):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-01 17:21:32.651: E/AndroidRuntime(296):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-01 17:21:32.651: E/AndroidRuntime(296):  at dalvik.system.NativeStart.main(Native Method)
04-01 17:21:32.651: E/AndroidRuntime(296): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-01 17:21:32.651: E/AndroidRuntime(296):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:582)
04-01 17:21:32.651: E/AndroidRuntime(296):  at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
04-01 17:21:32.651: E/AndroidRuntime(296):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-01 17:21:32.651: E/AndroidRuntime(296):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-01 17:21:32.651: E/AndroidRuntime(296):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
04-01 17:21:32.651: E/AndroidRuntime(296):  at android.app.Activity.setContentView(Activity.java:1647)
04-01 17:21:32.651: E/AndroidRuntime(296):  at com.tutos.android.gmapv2.MyMapActivity.onCreate(MyMapActivity.java:19)
04-01 17:21:32.651: E/AndroidRuntime(296):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-01 17:21:32.651: E/AndroidRuntime(296):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-01 17:21:32.651: E/AndroidRuntime(296):  ... 11 more
04-01 17:21:32.651: E/AndroidRuntime(296): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 7095000 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" />
04-01 17:21:32.651: E/AndroidRuntime(296):  at com.google.android.gms.common.GooglePlayServicesUtil.zzJ(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296):  at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296):  at com.google.android.gms.maps.internal.zzx.zzad(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296):  at com.google.android.gms.maps.internal.zzx.zzac(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296):  at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296):  at com.google.android.gms.maps.SupportMapFragment$zzb.zzqs(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296):  at com.google.android.gms.maps.SupportMapFragment$zzb.zza(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296):  at com.google.android.gms.dynamic.zza.zza(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296):  at com.google.android.gms.dynamic.zza.onInflate(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296):  at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296):  at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
04-01 17:21:32.651: E/AndroidRuntime(296):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:558)
04-01 17:21:32.651: E/AndroidRuntime(296):  ... 19 more
04-01 17:25:30.440: E/dalvikvm(305): Could not find class 'android.app.Notification$Builder', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
04-01 17:25:30.460: E/dalvikvm(305): Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
04-01 17:25:30.530: E/AndroidRuntime(305): FATAL EXCEPTION: main
04-01 17:25:30.530: E/AndroidRuntime(305): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tutos.android.gmapv2/com.tutos.android.gmapv2.MyMapActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-01 17:25:30.530: E/AndroidRuntime(305):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-01 17:25:30.530: E/AndroidRuntime(305):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-01 17:25:30.530: E/AndroidRuntime(305):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-01 17:25:30.530: E/AndroidRuntime(305):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-01 17:25:30.530: E/AndroidRuntime(305):  at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 17:25:30.530: E/AndroidRuntime(305):  at android.os.Looper.loop(Looper.java:123)
04-01 17:25:30.530: E/AndroidRuntime(305):  at android.app.ActivityThread.main(ActivityThread.java:4627)
04-01 17:25:30.530: E/AndroidRuntime(305):  at java.lang.reflect.Method.invokeNative(Native Method)
04-01 17:25:30.530: E/AndroidRuntime(305):  at java.lang.reflect.Method.invoke(Method.java:521)
04-01 17:25:30.530: E/AndroidRuntime(305):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-01 17:25:30.530: E/AndroidRuntime(305):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-01 17:25:30.530: E/AndroidRuntime(305):  at dalvik.system.NativeStart.main(Native Method)
04-01 17:25:30.530: E/AndroidRuntime(305): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-01 17:25:30.530: E/AndroidRuntime(305):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:582)
04-01 17:25:30.530: E/AndroidRuntime(305):  at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
04-01 17:25:30.530: E/AndroidRuntime(305):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-01 17:25:30.530: E/AndroidRuntime(305):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-01 17:25:30.530: E/AndroidRuntime(305):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
04-01 17:25:30.530: E/AndroidRuntime(305):  at android.app.Activity.setContentView(Activity.java:1647)
04-01 17:25:30.530: E/AndroidRuntime(305):  at com.tutos.android.gmapv2.MyMapActivity.onCreate(MyMapActivity.java:19)
04-01 17:25:30.530: E/AndroidRuntime(305):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-01 17:25:30.530: E/AndroidRuntime(305):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-01 17:25:30.530: E/AndroidRuntime(305):  ... 11 more
04-01 17:25:30.530: E/AndroidRuntime(305): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 7095000 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" />
04-01 17:25:30.530: E/AndroidRuntime(305):  at com.google.android.gms.common.GooglePlayServicesUtil.zzJ(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305):  at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305):  at com.google.android.gms.maps.internal.zzx.zzad(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305):  at com.google.android.gms.maps.internal.zzx.zzac(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305):  at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305):  at com.google.android.gms.maps.SupportMapFragment$zzb.zzqs(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305):  at com.google.android.gms.maps.SupportMapFragment$zzb.zza(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305):  at com.google.android.gms.dynamic.zza.zza(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305):  at com.google.android.gms.dynamic.zza.onInflate(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305):  at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305):  at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
04-01 17:25:30.530: E/AndroidRuntime(305):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:558)
04-01 17:25:30.530: E/AndroidRuntime(305):  ... 19 more

1 个答案:

答案 0 :(得分:2)

您的manifest.xml文件缺少以下行,只需添加它就可以解决您的问题。

编辑应用程序的AndroidManifest.xml文件,并在元素中添加以下声明。这会嵌入应用程序编译的Google Play服务版本。

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

Android开发者指南了解更多详情https://developers.google.com/maps/documentation/android/start