-1

I am trying the example as given in Google maps tutorial. But unable to execute it shows to update the Google play services. when i click on update application crashes. I am fed of trying. please help to solve this problem or please give me any tutorials on Google Maps for android programming.

layout_main.xml

<?xml version="1.0" encoding="utf-8"?>
   <fragment xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/map"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   class="com.google.android.gms.maps.MapFragment"/>

Manifest.xml

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

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

<permission
    android:name="com.example.mapdemo.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />

<uses-permission android:name="com.example.mapdemo.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" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <uses-library android:name="com.google.android.maps" />

    <activity
        android:name="com.mapviewsample.MapSampleActivity"
        android:label="@string/app_name"
         android:theme="@android:style/Theme.NoTitleBar" >
        <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="AIzaSyCQLmBXPhSNhbHBaWH_SDBf1gFu3JNN0H4" />
</application>

Sahil Mahajan Mj
  • 11,033
  • 8
  • 53
  • 100
Sandeep212
  • 29
  • 1
  • 6
  • I'd try to restart the phone and retry the update one last time, I for one do not know of a workaround for running it properly without updating. http://android.stackexchange.com/ may be a helpful place if you can't get it to update. – Joachim Isaksson Jan 16 '13 at 11:50
  • https://developers.google.com/maps/documentation/android/start this is llink m using for excuting the google Maps – Sandeep212 Jan 16 '13 at 11:53

3 Answers3

0

If you use "android:minSdkVersion="8"",

1.in your layout_man.xml, you must modify tag as follows;

  (X) class="com.google.android.gms.maps.MapFragment" 
  (o) class="com.google.android.gms.maps.SupportMapFragment"

2.For more perfect information, see this link below, which is useful to you;

click here and then you will see a good tutorial

3 . And please see my recent explanation;

https://stackoverflow.com/a/14355702/1983061

Community
  • 1
  • 1
BBonDoo
  • 766
  • 5
  • 14
0

There are 2 thing to do:

  • fix your layout

class="com.google.android.gms.maps.MapFragment"

to

class="com.google.android.gms.maps.SupportMapFragment"

Community
  • 1
  • 1
Fido
  • 595
  • 1
  • 9
  • 29
0

This worked for me. If you are using the current version of android studio by IntelliJ, in the build.gradle file replace this line

    compile 'com.google.android.gms:play-services:+'

with :

      compile 'com.google.android.gms:play-services:4.4.52'

and you should be good to go.

This question might be old but hope it helps someone who might be struggling with this.