Another Google maps v2 Failed to inflate PLEASE [duplicate]-Collection of common programming errors
i know there was a bunch of posts about this but i just can’t get my google maps to work. I have tried million different ways to get this and i found that the best way is like this:
MainActivity.java
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@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_main, menu);
return true;
}
}
activity_main.xml
Manifest.xml
But i still get this error that lots of people are getting 🙁 And i implemented google-play-services_lib
05-13 13:18:39.673: E/ActivityThread(14542): Failed to inflate
05-13 13:18:39.673: E/ActivityThread(14542): android.view.InflateException: Binary XML file line #7: Error inflating class fragment
05-13 13:18:39.673: E/ActivityThread(14542): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
05-13 13:18:39.673: E/ActivityThread(14542): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
05-13 13:18:39.673: E/ActivityThread(14542): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
05-13 13:18:39.673: E/ActivityThread(14542): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
05-13 13:18:39.673: E/ActivityThread(14542): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
05-13 13:18:39.673: E/ActivityThread(14542): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:274)
05-13 13:18:39.673: E/ActivityThread(14542): at android.app.Activity.setContentView(Activity.java:1881)
05-13 13:18:39.673: E/ActivityThread(14542): at in.wptrafficanalyzer.locationgooglemapv2demo.MainActivity.onCreate(MainActivity.java:12)
05-13 13:18:39.673: E/ActivityThread(14542): at android.app.Activity.performCreate(Activity.java:5122)
05-13 13:18:39.673: E/ActivityThread(14542): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1150)
05-13 13:18:39.673: E/ActivityThread(14542): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2432)
05-13 13:18:39.673: E/ActivityThread(14542): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2530)
05-13 13:18:39.673: E/ActivityThread(14542): at android.app.ActivityThread.access$600(ActivityThread.java:176)
05-13 13:18:39.673: E/ActivityThread(14542): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1385)
05-13 13:18:39.673: E/ActivityThread(14542): at android.os.Handler.dispatchMessage(Handler.java:107)
05-13 13:18:39.673: E/ActivityThread(14542): at android.os.Looper.loop(Looper.java:194)
05-13 13:18:39.673: E/ActivityThread(14542): at android.app.ActivityThread.main(ActivityThread.java:5546)
05-13 13:18:39.673: E/ActivityThread(14542): at java.lang.reflect.Method.invokeNative(Native Method)
05-13 13:18:39.673: E/ActivityThread(14542): at java.lang.reflect.Method.invoke(Method.java:525)
05-13 13:18:39.673: E/ActivityThread(14542): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-13 13:18:39.673: E/ActivityThread(14542): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
05-13 13:18:39.673: E/ActivityThread(14542): at dalvik.system.NativeStart.main(Native Method)
05-13 13:18:39.673: E/ActivityThread(14542): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4323000 but found 0. You must have the following declaration within the element:
05-13 13:18:39.673: E/ActivityThread(14542): at com.google.android.gms.common.GooglePlayServicesUtil.t(Unknown Source)
05-13 13:18:39.673: E/ActivityThread(14542): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
05-13 13:18:39.673: E/ActivityThread(14542): at com.google.android.gms.maps.internal.q.B(Unknown Source)
05-13 13:18:39.673: E/ActivityThread(14542): at com.google.android.gms.maps.internal.q.A(Unknown Source)
05-13 13:18:39.673: E/ActivityThread(14542): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
05-13 13:18:39.673: E/ActivityThread(14542): at com.google.android.gms.maps.SupportMapFragment$b.gW(Unknown Source)
05-13 13:18:39.673: E/ActivityThread(14542): at com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source)
05-13 13:18:39.673: E/ActivityThread(14542): at com.google.android.gms.dynamic.a.a(Unknown Source)
05-13 13:18:39.673: E/ActivityThread(14542): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
05-13 13:18:39.673: E/ActivityThread(14542): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
05-13 13:18:39.673: E/ActivityThread(14542): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
05-13 13:18:39.673: E/ActivityThread(14542): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
05-13 13:18:39.673: E/ActivityThread(14542): ... 21 more
05-13 13:18:39.683: E/AndroidRuntime(14542): FATAL EXCEPTION: main
05-13 13:18:39.683: E/AndroidRuntime(14542): java.lang.RuntimeException: Unable to start activity ComponentInfo{in.wptrafficanalyzer.locationgooglemapv2demo/in.wptrafficanalyzer.locationgooglemapv2demo.MainActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
05-13 13:18:39.683: E/AndroidRuntime(14542): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2478)
05-13 13:18:39.683: E/AndroidRuntime(14542): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2530)
05-13 13:18:39.683: E/AndroidRuntime(14542): at android.app.ActivityThread.access$600(ActivityThread.java:176)
05-13 13:18:39.683: E/AndroidRuntime(14542): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1385)
05-13 13:18:39.683: E/AndroidRuntime(14542): at android.os.Handler.dispatchMessage(Handler.java:107)
05-13 13:18:39.683: E/AndroidRuntime(14542): at android.os.Looper.loop(Looper.java:194)
05-13 13:18:39.683: E/AndroidRuntime(14542): at android.app.ActivityThread.main(ActivityThread.java:5546)
05-13 13:18:39.683: E/AndroidRuntime(14542): at java.lang.reflect.Method.invokeNative(Native Method)
05-13 13:18:39.683: E/AndroidRuntime(14542): at java.lang.reflect.Method.invoke(Method.java:525)
05-13 13:18:39.683: E/AndroidRuntime(14542): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-13 13:18:39.683: E/AndroidRuntime(14542): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
05-13 13:18:39.683: E/AndroidRuntime(14542): at dalvik.system.NativeStart.main(Native Method)
05-13 13:18:39.683: E/AndroidRuntime(14542): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
05-13 13:18:39.683: E/AndroidRuntime(14542): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
05-13 13:18:39.683: E/AndroidRuntime(14542): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
05-13 13:18:39.683: E/AndroidRuntime(14542): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
05-13 13:18:39.683: E/AndroidRuntime(14542): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
05-13 13:18:39.683: E/AndroidRuntime(14542): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
05-13 13:18:39.683: E/AndroidRuntime(14542): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:274)
05-13 13:18:39.683: E/AndroidRuntime(14542): at android.app.Activity.setContentView(Activity.java:1881)
05-13 13:18:39.683: E/AndroidRuntime(14542): at in.wptrafficanalyzer.locationgooglemapv2demo.MainActivity.onCreate(MainActivity.java:12)
05-13 13:18:39.683: E/AndroidRuntime(14542): at android.app.Activity.performCreate(Activity.java:5122)
05-13 13:18:39.683: E/AndroidRuntime(14542): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1150)
05-13 13:18:39.683: E/AndroidRuntime(14542): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2432)
05-13 13:18:39.683: E/AndroidRuntime(14542): ... 11 more
05-13 13:18:39.683: E/AndroidRuntime(14542): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4323000 but found 0. You must have the following declaration within the element:
05-13 13:18:39.683: E/AndroidRuntime(14542): at com.google.android.gms.common.GooglePlayServicesUtil.t(Unknown Source)
05-13 13:18:39.683: E/AndroidRuntime(14542): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
05-13 13:18:39.683: E/AndroidRuntime(14542): at com.google.android.gms.maps.internal.q.B(Unknown Source)
05-13 13:18:39.683: E/AndroidRuntime(14542): at com.google.android.gms.maps.internal.q.A(Unknown Source)
05-13 13:18:39.683: E/AndroidRuntime(14542): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
05-13 13:18:39.683: E/AndroidRuntime(14542): at com.google.android.gms.maps.SupportMapFragment$b.gW(Unknown Source)
05-13 13:18:39.683: E/AndroidRuntime(14542): at com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source)
05-13 13:18:39.683: E/AndroidRuntime(14542): at com.google.android.gms.dynamic.a.a(Unknown Source)
05-13 13:18:39.683: E/AndroidRuntime(14542): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
05-13 13:18:39.683: E/AndroidRuntime(14542): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
05-13 13:18:39.683: E/AndroidRuntime(14542): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
05-13 13:18:39.683: E/AndroidRuntime(14542): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
05-13 13:18:39.683: E/AndroidRuntime(14542): ... 21 more
Please people can someone help me…i’m trying to make simple google maps app for more than a month and i ran out of options… 🙁