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?