Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

“App won't run unless you update Google Play services” with Google Maps API

I created an app with Google Maps API. After few hours of trying to resolve errors, I successfuly runned it(without crashes). But now I get a error.

enter image description here

That alert means “App won't run unless you update Google Play services”. I heard about that error with emulator, but I'm using real device(LG P350 on Gingerbread). I have got device with android 2.3 so I use SupportLibrary.

My activity file

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".Map" >

     <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />

</RelativeLayout>

And AndroidManifest

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

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



        <permission
            android:name="io.secorp.where360.permission.MAPS_RECEIVE"
            android:protectionLevel="signature"/>
        <uses-permission android:name="io.secorp.where360.permission.MAPS_RECEIVE"/>    
        <uses-permission android:name="android.permission.INTERNET"/>
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
        <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
        <!-- The following two permissions are not required to use
         Google Maps Android API v2, but are recommended. -->
        <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" >

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

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


        <activity
            android:name="io.secrop.where360.Map"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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


    </application>

</manifest>

Any ideas?

like image 211
Sekhmet Avatar asked Dec 19 '22 22:12

Sekhmet


1 Answers

You have hit a wrong point in time.

Google Play Services have been updated to 4.0.30 very recently and so you seem to be using that version of google-play-services_lib. Assumption based on this line:

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

Not all devices have received an update of GooglePlayServices.APK, which needs to be at least the same version as a client library you are using.

Check version of GPServices.APK in Settings app. For me it is still at 3.2.66 and last time I had to wait few days for the update.

If you are using gradle, you can put lower version dependency. If not, you have to download older version of google-play-services_lib from somewhere.

Edit:

or get Google Play Services for Froyo from Android SDK. It is the same as previous release (3.2.65).

like image 97
MaciejGórski Avatar answered Jan 24 '23 02:01

MaciejGórski