Question

i am trying google maps so had download the google maps project from following link

http://wptrafficanalyzer.in/blog/locating-user-input-address-in-google-maps-android-api-v2-with-geocoding-api/

I have already put the API key in Manifest.

But it gives following following error

java.lang.RuntimeException: Unable to start activity ComponentInfo{in.wptrafficanalyzer.locationgeocodingapiv2/in.wptrafficanalyzer.locationgeoc
odingapiv2.MainActivity}: android.view.InflateException: Binary XML file line #24:Error inflating class fragment

04-11 16:09:55.679: E/AndroidRuntime(3510): at  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)

04-11 16:09:55.679: E/AndroidRuntime(3510):at android.app.ActivityThread.performLaunchActivity (Activity Thread .java: 1651)

04-11 16:09:55.679: E/AndroidRuntime(3510): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)

04-11 16:09:55.679: E/AndroidRuntime(3510): at   android.app.ActivityThread.access$1500(ActivityThread.java:117)

04-11 16:09:55.679: E/AndroidRuntime(3510):at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)


04-11 16:09:55.679: E/AndroidRuntime(3510): Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class fragment

04-11 16:09:55.679: E/AndroidRuntime(3510): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)

04-11 16:09:55.679: E/AndroidRuntime(3510): at android.app.Activity.setContentView(Activity.java:1657)

04-11 16:09:55.679: E/AndroidRuntime(3510): at in.wptrafficanalyzer.locationgeocodingapiv2.MainActivity.onCreate(MainActivity.java:46)

04-11 16:09:55.679: E/AndroidRuntime(3510): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

04-11 16:09:55.679: E/AndroidRuntime(3510): Caused by: java.lang.IllegalStateException:    The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 4242000 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-11 16:09:55.679: E/AndroidRuntime(3510): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)

04-11 16:09:55.679: E/AndroidRuntime(3510): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)

I have already give the API key mainfeast and extend my activity to the fragmentActivity

Plz Help me out.

My AndroidMainfest.xml

 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.wptrafficanalyzer.locationgeocodingapiv2"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

<permission
      android:name="in.wptrafficanalyzer.locationgeocodingapiv2.permission.MAPS_RECEIVE"
      android:protectionLevel="signature"/>

<uses-permission android:name="in.wptrafficanalyzer.locationgeocodingapiv2.permission.MAPS_RECEIVE"/>

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>    

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="package.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

   <meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="MY API keY" />


</application>

Was it helpful?

Solution

Try to add <meta-data> tag under <application> tag in your manifest.xml file like

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

Make your manifest.xml like this

....<application>
 ..............
  <meta-data
   android:name="com.google.android.maps.v2.API_KEY"
    android:value="Key" />

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

   </application>

and give me feedback on this

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top