0

my app crashes on line

setContentView(R.layout.activity_map);

I'm using google maps api v2, i used to run this app on former eclipse and android sdk and it worked, after reinstallation of android sdk, got this exception

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)
tshepang
  • 12,111
  • 21
  • 91
  • 136
Jenya Kirmiza
  • 701
  • 2
  • 10
  • 27

2 Answers2

1

try to add Google play service as reference to your project...

and even add in androidmanifest.xml

 <meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
vinay Maneti
  • 1,447
  • 1
  • 23
  • 31
0

The explanation lies within your stacktrace:

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" />

Ben Weiss
  • 17,182
  • 6
  • 67
  • 87