Google map api v2 and older google play services lib

I am going to use maps in my Android application and I have to use Google Play services. I read a lot of q \ a here, for example. In the mentioned question, accepted answers are suggested using an older version of google play services lib, e.g. for Froyo. I downloaded google play services r10 and used it in my application, but I got errors.

If I exclude this line of code from the manifest:

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

and run the application on my device (the current version of google playe services on my device is 3.2.66), this causes an error:

 java.lang.IllegalStateException: The meta-data tag in your app 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" /> 

and if I turn it on in android: value = 4030500, the application will start, but says that I should update my “Google game services”.

So, what should I put android: value or is my method correct?

Hi

+7
android google-play google-maps
source share
3 answers

I downloaded google play services r10 and used it in my application

The above statement is the root cause of your problems. If you really used r10 (or even r12) than after removal

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

from your AndroidManifest, you will not get this error:

 java.lang.IllegalStateException: The meta-data tag in your app 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" /> 

This error simply says that you are associated with the version of the Google Play services library 4.0.30.

So, the solution is to remove the above meta-data and make sure that you are referring to one of the previous versions.

When using gradle or maven just set the dependency version to 3.2.65. If you are developing an old method, download the Google Play services for Froyo in the Android SDK Manager, copy it from sdk/extras/google/ to the working directory and in your project preferences select this project as a library dependent project.

+4
source share

I also had a problem. After adding these two lines to the manifest file, it worked.

 <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyBAjfcxZvbt_COHjy7igHZnLBfsO1cfoM8" /> 
+4
source share

Update your Google Play services to the last of your sdk manager, which is rev 13

You need to add below to manifest file

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

https://developers.google.com/maps/documentation/android/start#add_the_google_play_services_version_to_your_apps_manifest .

This is a new requirement added from the latest update 13 of the update to google-play services.

+3
source share

All Articles