Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Google Play Services for Froyo compatible with Android 2.3 and higher?

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?

like image 407
Sean Barbeau Avatar asked Dec 12 '13 02:12

Sean Barbeau


2 Answers

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?

like image 155
gian1200 Avatar answered Nov 05 '22 17:11

gian1200


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.)

like image 45
Sean Barbeau Avatar answered Nov 05 '22 16:11

Sean Barbeau