7

In reading the Google Play Services setup documentation, it sounds like Google Play Services for Froyo Rev. 12 should be forwards-compatible with Android 2.3 and above.

However, I'm having issues implementing this in my GPSTest app on Github, which currently includes Google Play Services for Froyo.

If I try to build a project using Google Play Services for Froyo Rev. 12 with the element:

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

...included in the AndroidManifest.xml, I get a build error:

Error: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').

This is expected (from my current understanding) because this integer doesn't exist in the Google Play Services for Froyo project (sdk\extras\google\google_play_services_froyo\res\values).

If I remove this element from the manifest, it works fine when building and debugging the app via Eclipse (as I would expect). However, when I export the APK, install on a device (Samsung Galaxy S3 Android 4.3, Google Play Services v4.0.34 - downloading the exported APK from Dropbox), and run, I get the following error on startup, and the app crashes:

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" />
        at com.google.android.gms.common.b.a(Unknown Source)
        at com.google.android.gms.maps.a.bn.a(Unknown Source)
        at com.google.android.gms.maps.m.g(Unknown Source)
        at com.google.android.gms.maps.m.a(Unknown Source)
        at com.google.android.gms.a.b.a(Unknown Source)
        at com.google.android.gms.a.b.a(Unknown Source)
        at com.google.android.gms.maps.SupportMapFragment.onCreate(Unknown Source)
        at android.support.v4.app.Fragment.performCreate(Unknown Source)
        at android.support.v4.app.FragmentManagerImpl.moveToState(Unknown Source)
        at android.support.v4.app.FragmentManagerImpl.moveToState(Unknown Source)
        at android.support.v4.app.BackStackRecord.run(Unknown Source)
        at android.support.v4.app.FragmentManagerImpl.execPendingActions(Unknown Source)
        at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(Unknown Source)
        at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(Unknown Source)
        at android.support.v4.view.ViewPager.populate(Unknown Source)
        at android.support.v4.view.ViewPager.populate(Unknown Source)
        at android.support.v4.view.ViewPager.onMeasure(Unknown Source)
        at android.view.View.measure(View.java:16848)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
        at android.view.View.measure(View.java:16848)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245)
        at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:302)
        at android.view.View.measure(View.java:16848)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
        at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2586)
        at android.view.View.measure(View.java:16848)
        at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2189)
        at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1352)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1535)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1249)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6364)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:791)
        at android.view.Choreographer.doCallbacks(Choreographer.java:591)
        at android.view.Choreographer.doFrame(Choreographer.java:561)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777)
        at android.os.Handler.handleCallback(Handler.java:730)
        at android.os.Handler.dispatchMessage(Handler.java:92)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:5455)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:525)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
        at dalvik.system.NativeStart.main(Native Method)

I'm using Google Play Services for Froyo Rev. 12, and here's the AndroidManifest.xml with the full version info:

<manifest android:versionName="3.2.65 (834000-30)" android:versionCode="3265130" 
    package="com.google.android.gms" 
    xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-sdk android:minSdkVersion="8"/>  </manifest>

Is there a way I can deploy a single APK to Google Play using Google Play Services for Froyo Rev. 12 for Android 2.2 and higher?

Or do I need to deploy two APKs to Google Play (one using Google Play Services for Froyo for Android 2.2, and one using Google Play Services for Android 2.3 and up) if I want to retain support for Froyo?

Has anyone successfully deployed Google Play Services for Froyo on Android 2.3 and up?

Sean Barbeau
  • 11,496
  • 8
  • 58
  • 111
  • 1
    I assume you have referenced the library correctly. The "integer" should exist in the "sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values.xml" file in your SDK folder. I encountered a similar error a few weeks back. I am using Android Studio. In my gradle build file, I specified "compile 'com.google.android.gms:play-services:4.0.+" . What I did, is to do a "clean" then I hit the "Sync Project With Gradle Files" and viola! the problem disappeared. – alpinescrambler Dec 12 '13 at 03:11
  • @alpinescrambler - that is for Google Play Services (Gingerbread+), not Google Play Services for Froyo (which is still version 3.2.65 of Google Play Services). – ianhanniballake Dec 12 '13 at 03:30
  • Right, @alpinescrambler, in the Google Play Services for Froyo package (sdk\extras\google\google_play_services_froyo), the integer doesn't exist. – Sean Barbeau Dec 12 '13 at 03:32
  • My SDK Manager does not show "Google Play Services for Froyo" library also the above link "develop branch on Github" is 404. – Ashish Shukla Dec 07 '15 at 09:26
  • @AshishShukla Thanks! I fixed the link. In SDK Manager, "Google Play Services for Froyo" is under the last section "Extras". – Sean Barbeau Dec 07 '15 at 14:41

5 Answers5

11

You dont need

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

That is for the Up-to-date Google Play Services revision. If you use the "Google Play Services for Froyo" library, then you don't need it.

Now, talking about the other problem. How exactly are you "debugging the app via Eclipse"? Are you using the debug key or your release key? how are you installing the APK inside the device? have you tried to do a uninstall->install? Did you use the ADB install or you uploaded the APK as an Alpha/Beta test? Are you sure that you are installing the right APK?

gian1200
  • 3,670
  • 2
  • 30
  • 59
  • I'm using standard "green play button" to launch a Run configuration in Eclipse for an Android app. It uses the default debug key for Eclipse. Yes, I've tried uninstall/reinstall multiple times for both the debug and exported APK (using Eclipse "Export..." feature). I'm sideloading the exported APK (downloaded from Dropbox) - I haven't uploaded it to Google Play. Yes, definitely the right APK - I've exported several times. Have you deployed Google Play Services for Froyo on a newer device successfully? – Sean Barbeau Dec 12 '13 at 18:54
5

The answer is yes, Google Play Services for Froyo is forwards compatible with Android 2.3 and higher, and the manifest element isn't needed.

Looks like this issue was actually a bug in the Google Maps app.

A Maps app update started rolling out yesterday (12/12/2013), and my phone installed it today (new version is v7.5.0). After this, the crashing problem on startup magically disappeared. I even went back and tested an old version of the APK from Dropbox that was definitely crashing (just in case my other changes in Eclipse fixed something), and that now works as well.

(Note that you should only be using Google Play Services for Froyo if you're supporting API level 8 - Android 2.2. If your minSdkVersion is >= 9, then you should be using the most recent version of Google Play Services, as no new features are being added to Google Play Services for Froyo.)

Sean Barbeau
  • 11,496
  • 8
  • 58
  • 111
1

It is a weird bug, I solved this problem by this way - just changed android:value="@integer/google_play_services_version" to 3265130.

whizzzkey
  • 926
  • 3
  • 21
  • 52
  • Including the following in the manifest doesn't fix the issue - same crash and stacktrace: – Sean Barbeau Dec 12 '13 at 04:03
  • @SeanBarbeau Ok, open you google.play.services lib manifest and check version code. This version should be in "android:value=" – whizzzkey Dec 12 '13 at 04:10
  • 1
    In the Google Play Services for Froyo package (sdk\extras\google\google_play_services_froyo), the integer doesn't exist. – Sean Barbeau Dec 12 '13 at 04:12
  • @SeanBarbeau Didn't understand you, so then why in my lib integer is exists? – whizzzkey Dec 12 '13 at 04:14
  • What rev. of Google Play Services for Froyo is this from? I'm using rev. 12, which is the most recent version. – Sean Barbeau Dec 12 '13 at 04:16
  • @SeanBarbeau I'm using rev 12 too, but your logcat says here "Expected 4030500 but found 0" that your version is 13, are you sure that you've added a right lib? – whizzzkey Dec 12 '13 at 04:18
  • Sorry, missed the word "manifest" in your last post. My lib manifest matches yours. Definitely using Froyo lib, I've triple-checked, since it seems strange to me too. – Sean Barbeau Dec 12 '13 at 04:22
  • @SeanBarbeau but i didn't get why your logcat says that you use version code 4030500 - it is code of verison 13. Check again all foreign links in you project. – whizzzkey Dec 12 '13 at 04:25
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/43001/discussion-between-whizzzkey-and-sean-barbeau) – whizzzkey Dec 12 '13 at 04:26
0

enter image description here

Create an integer resource seems to solve the problem.

But I ended up bumping into each other.

enter image description here

enter image description here

There is no package "ads.AdActivity". Even adding the froyo version:

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

The documentation says nothing about the froyo version:

https://developers.google.com/mobile-ads-sdk/docs/

alex
  • 104
  • 4
  • 10
0

For me, the java.lang.IllegalStateException seemed to occur because I had previously linked to the full Google Play services (version 22) before changing to Google Play services for Froyo. There must have been some remnant of version 22 left in the build and doing a full clean and rebuild fixed the problem.

zelanix
  • 3,326
  • 1
  • 25
  • 35