2015-08-23 106 views
0

我收到錯誤08-23 13:27:35.790: W/dalvikvm(1608):VFY:無法解析虛擬方法184:Landroid/app/Notification $ Builder; .setLocalOnly (Z)Landroid /應用/通知$生成器;Google Maps API V2拋出錯誤

所有鍵,谷歌播放庫等都可以,但在模擬器中發生錯誤。

08-23 13:27:36.260: E/AndroidRuntime(1608): FATAL EXCEPTION: main 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): Process: ca.sfu.cmpt276.bfraser, PID: 1608 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): java.lang.RuntimeException: Unable to start activity ComponentInfo{ca.sfu.cmpt276.bfraser/ca.sfu.cmpt276.bfraser.MainActivity}: android.view.InflateException: Binary XML file line #22: Error inflating class fragment 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at android.app.ActivityThread.access$800(ActivityThread.java:135) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at android.os.Handler.dispatchMessage(Handler.java:102) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at android.os.Looper.loop(Looper.java:136) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at android.app.ActivityThread.main(ActivityThread.java:5017) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at java.lang.reflect.Method.invokeNative(Native Method) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at java.lang.reflect.Method.invoke(Method.java:515) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at dalvik.system.NativeStart.main(Native Method) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): Caused by: android.view.InflateException: Binary XML file line #22: Error inflating class fragment 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:714) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at android.view.LayoutInflater.rInflate(LayoutInflater.java:756) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at android.app.Activity.setContentView(Activity.java:1929) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at ca.sfu.cmpt276.bfraser.MainActivity.onCreate(MainActivity.java:24) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at android.app.Activity.performCreate(Activity.java:5231) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t ... 11 more 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 7895000 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" /> 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at com.google.android.gms.common.GooglePlayServicesUtil.zzad(Unknown Source) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at com.google.android.gms.maps.internal.zzy.zzaG(Unknown Source) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at com.google.android.gms.maps.internal.zzy.zzaF(Unknown Source) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at com.google.android.gms.maps.MapFragment$zzb.zzwP(Unknown Source) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at com.google.android.gms.maps.MapFragment$zzb.zza(Unknown Source) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at com.google.android.gms.dynamic.zza.zza(Unknown Source) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at com.google.android.gms.dynamic.zza.onInflate(Unknown Source) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at android.app.Activity.onCreateView(Activity.java:4785) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:690) 
 
08-23 13:27:36.260: E/AndroidRuntime(1608): \t ... 21 more

回答

1

由於您使用的谷歌地圖,你需要添加Play服務版本。在<application>元素內添加以下聲明:

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

非常感謝..它的工作.. –

+0

爲什麼需要它?另外,我應該爲其他人做些什麼?我使用com.google.android.gms:play-services-plus:8.0.0和com.google.android.gms:play-services-ads:8.0.0,並且我有一個非常類似的錯誤(但只有在運行時在發佈模式) –