Android Play Services FusedLocatioAPI getLastLocation crashes with SecurityException - android

A few days ago Crashlytics startet reporting weird crashes within my Google Play Services Location API Implementation. After the Google Play Services API is connected I try to get the last known location with FusedLocationApi.getLastLocation(...) but this call ends in a Security Exception telling me I don't have the right permission to do that (see stack trace below)
I do have the runtime permissions and this code is working on most devices for a few months. This error occurs mainly on the OnePlus One and I could repoduce it on a HTC One M8 with Android 6.
I think the problem is related to the latest google play services update but I could not validate this. This error occurs only if the devices location services are disabled (which actually automatically removes the location permission from google play services) so I think the newest play services on these devices have a bug that throws the security exception cause the google play services do not have the permission to access location data although my app does.
Is anyone experiencing a similar problem and maybe had found a better solution then try{}catch the whole thing or any update from google about the issue?
UPDATE:
I could test this again on HTC One M8 with Android 6.0 and the SecurityException is also thrown with enabled location services and grantet permissions to the app and the play services.
Switching between BALANCED_POWER AND HIGH_ACCURACY has no effect except chaning the exception message to
Client must have ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION
permission to perform any location operations.
File access Permission has no issues and my fallback implementation which useses the Android LocationManager throws no SecurityException but the location is only determined when location services set to gps only.
Interessting fact: Google Play Services crash every few seconds when using Google Maps and no location can be found. Only navigation, which enables gps can find the location.
In summary
The HTC One M8 (Android 6.0 Software Nr. 6.12.401.4) with Google Play Services 9.2.56 (438-124593566) has a general problem with Location services which are not gps only. The Google Play Services FusedLocationApi has an issue with the permission system cause the permissions are given but it throws a SecurityException. Using old LocationManager implementation has no security issues but can only determine the location if device settings are set to gps only.
The Stacktrace:
Fatal Exception: java.lang.SecurityException: Client must have ACCESS_FINE_LOCATION permission to request PRIORITY_HIGH_ACCURACY locations.
at android.os.Parcel.readException(Parcel.java:1620)
at android.os.Parcel.readException(Parcel.java:1573)
at com.google.android.gms.location.internal.zzi$zza$zza.zza(Unknown Source)
at com.google.android.gms.location.internal.zzk.getLastLocation(Unknown Source)
at com.google.android.gms.location.internal.zzl.getLastLocation(Unknown Source)
at com.google.android.gms.location.internal.zzd$1.zza(Unknown Source)
at com.google.android.gms.location.internal.zzd$1.zza(Unknown Source)
at com.google.android.gms.internal.zznt$zza.zzre(Unknown Source)
at com.google.android.gms.internal.zzoc.connect(Unknown Source)
at com.google.android.gms.internal.zzoc.zzd(Unknown Source)
at com.google.android.gms.internal.zzoh.zzd(Unknown Source)
at com.google.android.gms.internal.zzof.zzd(Unknown Source)
at com.google.android.gms.location.internal.zzd.getLastLocation(Unknown Source)
at com.my.package.location.PlayServicesLocationFinder.onConnected(PlayServicesLocationFinder.java:74)
at com.google.android.gms.common.internal.zzl.zztI(Unknown Source)
at com.google.android.gms.internal.zzof.zzc(Unknown Source)
at com.google.android.gms.internal.zzod.zzsb(Unknown Source)
at com.google.android.gms.internal.zzod.begin(Unknown Source)
at com.google.android.gms.internal.zzoh.zzc(Unknown Source)
at com.google.android.gms.internal.zznw.onConnected(Unknown Source)
at com.google.android.gms.common.internal.zzk$1.onConnected(Unknown Source)
at com.google.android.gms.common.internal.zzd$zzj.zzl(Unknown Source)
at com.google.android.gms.common.internal.zzd$zza.zztp(Unknown Source)
at com.google.android.gms.common.internal.zzd$zza.zztp(Unknown Source)
at com.google.android.gms.common.internal.zzd$zze.zztr(Unknown Source)
at com.google.android.gms.common.internal.zzd$zzd.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5461)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

should be fixed now, in Play Services 9.6 https://developers.google.com/maps/documentation/android-api/releases#september_21_2016
September 21, 2016
Resolved Issues
Client must have ACCESS_FINE_LOCATION permission to request PRIORITY_HIGH_ACCURACY locations. (Issue 10166)

Related

GET_ACCOUNTS permission and Google API's

I'm using the Gmail API to send emails from an Android app.
Reading about GET_ACCOUNTS permission lead me to think it's no longer necessary but apparently, I was wrong.
I personally use Android 8 and everything is working just fine without the permission declared, however, running Android 7 raises an exception from the Google GMS Auth lib: (I know, the exception doesn't look related, it is the permission issue)
java.lang.IllegalArgumentException: the name must not be empty: null
at android.accounts.Account.<init>(Account.java:48)
at com.google.android.gms.auth.zzd.getToken(Unknown Source)
at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.getToken(GoogleAccountCredential.java:267)
at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:292)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:868)
at com.google.api.client.googleapis.media.MediaHttpUploader.executeCurrentRequestWithoutGZip(MediaHttpUploader.java:545)
at com.google.api.client.googleapis.media.MediaHttpUploader.executeCurrentRequest(MediaHttpUploader.java:562)
at com.google.api.client.googleapis.media.MediaHttpUploader.executeUploadInitiation(MediaHttpUploader.java:519)
at com.google.api.client.googleapis.media.MediaHttpUploader.resumableUpload(MediaHttpUploader.java:384)
at com.google.api.client.googleapis.media.MediaHttpUploader.upload(MediaHttpUploader.java:336)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:427)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
So I guess I still need to declare it and ask the user to grant it on Android 7, but in what other SDK versions?
It looks like Android 8 doesn't need the permission, but what about Android 6 downwards?
I've looked all over the Google API's doc's but didn't find anything related...

java.lang.SecurityException: Method class android.media.IAudioService$Stub$Proxy.isCameraSoundForced[] not available

I'm getting the following error when calling Camera.open(cameraIndex) (Camera 1 API)
MethodInvocationProxy : Exception while calling method public abstract boolean android.media.IAudioService.isCameraSoundForced() throws android.os.RemoteException
java.lang.SecurityException: Method class android.media.IAudioService$Stub$Proxy.isCameraSoundForced[] not available to instant apps
06-18 10:23:43.361 26240-26359/? E/Isotope: UID: [10185] PID: [26240]
MethodInvocationStub : Exception while calling method
isCameraSoundForced
java.lang.SecurityException: Method class
android.media.IAudioService$Stub$Proxy.isCameraSoundForced[] not
available to instant apps
at com.google.android.instantapps.supervisor.ipc.proxies.SandboxEnforcer.enforceUnsupportedPolicy(PG:63)
at com.google.android.instantapps.supervisor.ipc.proxies.SandboxEnforcer.enforceUnsupportedMethodPolicy(PG:17)
at com.google.android.instantapps.supervisor.ipc.ProxyMethodHandler.handleMethod(PG:50)
at com.google.android.instantapps.supervisor.ipc.base.MethodInvocationStub.onTransact(PG:56)
at android.os.Binder.execTransact(Binder.java:453) 06-18 10:23:43.361
26274-26274/? E/Isotope: UID: [99000] PID: [26274]
MethodInvocationProxy : Exception while calling method public abstract
boolean android.media.IAudioService.isCameraSoundForced() throws
android.os.RemoteException
java.lang.SecurityException: Method class
android.media.IAudioService$Stub$Proxy.isCameraSoundForced[] not
available to instant apps
at android.os.Parcel.readException(Parcel.java:1620)
at android.os.Parcel.readException(Parcel.java:1573)
at com.google.android.instantapps.supervisor.ipc.base.MethodInvocationProxy.readReply(PG:39)
at com.google.android.instantapps.supervisor.ipc.base.MethodInvocationProxy.invoke(PG:130)
at java.lang.reflect.Proxy.invoke(Proxy.java:393)
at $Proxy5.isCameraSoundForced(Unknown Source)
at android.hardware.Camera.getCameraInfo(Camera.java:260)
at com.chegg.feature.wizard.camera.CameraActivity.getBackFacingCamera(CameraActivity.java:357)
at com.chegg.feature.wizard.camera.CameraActivity.startCamera(CameraActivity.java:101)
at com.chegg.feature.wizard.camera.CameraActivity.startCameraSafely(CameraActivity.java:79)
at com.chegg.feature.wizard.camera.CameraActivity.onResume(CameraActivity.java:74)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1286)
at android.app.Activity.performResume(Activity.java:6987)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4144)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3360)
at android.app.ActivityThread.access$1100(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
android.hardware.Camera was deprecated in API level 21, while Instant Apps support devices only from API level 23. You need to use android.hardware.camera2 instead.
https://developer.android.com/reference/android/hardware/camera2/package-summary.html
The android.hardware.camera2 package provides an interface to
individual camera devices connected to an Android device. It replaces
the deprecated Camera class.
This issue was addressed in https://issuetracker.google.com/issues/38485484
where Engineers provided the following information:
"Instant apps don't support the old deprecated android.hardware.Camera. They only support the camera2 APIs"
Instant apps have restricted functionality, obviously that method is not supported. You can use InstantApps.isInstantApp() method to determine whether it is installed or instant app and call isCameraSoundForced only for installed.
More info: https://developer.android.com/topic/instant-apps/reference.html
Instant apps run natively on Android O and on previous versions, they use google play services to run. So camera 1 is not supported in instant apps prior to API 26 as they don't run natively. However, you can use Camera 1 api in an instant app on API 26 and till the time Camera 1 api lives I would imagine.
However, I'm using camera 2 api in the instant app and camera 1 api in the installed app.
This is a bug in the current implementation of Google Play Services support of instant apps.
It will be fixed in a future release, at which point the android.hardware.Camera API should function correctly.
Unfortunately I don't have any specifics on the timeframe of the fix being available.

Firebase NullPointerException in Play Services 9.2.1

I updated Google Play Services in my app from 8.4.0 to 9.2.1 and started seeing the following crash coming in multiple times per day:
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'byte[] java.lang.String.getBytes()' on a null object reference
at android.util.Base64.decode(Base64.java:118)
at com.google.firebase.iid.zzg.zzkl(Unknown Source)
at com.google.firebase.iid.zzg.zzh(Unknown Source)
at com.google.firebase.iid.zzd.zzb(Unknown Source)
at com.google.firebase.iid.zzd.zzcxa(Unknown Source)
at com.google.firebase.iid.zzd.zzbmu(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.zzcww(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceIdService.zzaa(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceIdService.zzm(Unknown Source)
at com.google.firebase.iid.zzb$2.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
I am not explicitly including Firebase nor have I migrated from GCM yet, but I do have google services in my app. I think Firebase coming in through a dependency of my other play-services integrations or the google-services plugin. Here's a snippet of my build.gradle file:
compile 'com.google.android.gms:play-services-analytics:9.2.1'
compile 'com.google.android.gms:play-services-appindexing:9.2.1'
compile 'com.google.android.gms:play-services-places:9.2.1'
compile 'com.google.android.gms:play-services-gcm:9.2.1'
This crash seems very similar to this one but it's coming from getInstance() rather than getToken() so I'm wondering if anyone knows if I'm missing an integration or something like that? I'm hoping that the only answer isn't to wait for google to fix.
UPDATE: I added Firebase to my app through the dashboard, then generated a new google-services.json file, repackaged my app and released a patch. This did not seem to fix the problem, as I am still seeing occurrences in Crashlytics in the new version.
UPDATE 2: I still haven't found a solution, but I've noticed that these crashes are tapering off in Crashlytics. I had 40 the first day, 30 the second day, 10 the third day, and now down to ~4. This leads me to believe that this bug only affects new users or updating users, of which there were a lot initially as my users' apps upgraded to the new version. I still think this is a bug on Google's end and hope they will fix, but at least it's not as widespread as I initially thought.
As described in my updates, after a few days I saw fewer and fewer of these errors, until now a few weeks later I'm not seeing them at all anymore. So I guess the answer is that this intermittently affects users that are updating their apps, and eventually dies down on its own. Most likely no action is needed on the developer's part.

Android Firebase DynamiteModule: Failed to load module descriptor

Since upgrading to the newest version of Firebase (9.0.0), I can't get rid of the following two errors when authenticating a user through signInWithEmailAndPassword(). Does anyone have an idea what's going on?
05-19 18:09:49.245 23550-23589/[PACKAGE] E/DynamiteModule: Failed to load
module descriptor class: Didn't find class
"com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.ModuleDescriptor"
on path: DexPathList[[zip file
"/data/app/[PACKAGE]-3/base.apk"],nativeLibraryDirectories=
[/data/app/[PACKAGE]-3/lib/x86, /vendor/lib, /system/lib]]
And
05-19 18:09:49.252 23550-23550/[PACKAGE] E/FirebaseApp: Firebase API
initialization failure.java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
(...)
Caused by: java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'com.google.firebase.iid.zzg' appears in /data/data/[PACKAGE]/files/instant-run/dex/slice-com.google.firebase-firebase-iid-9.0.0_95503dc60ed409569d1585da411de93e6c633bf7-classes.dex)
at com.google.firebase.iid.zzg.zzeC(Unknown Source)
at com.google.firebase.iid.zzg.<init>(Unknown Source)
at com.google.firebase.iid.zzg.<init>(Unknown Source)
at com.google.firebase.iid.zzd.zzb(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method) 
at com.google.firebase.FirebaseApp.zza(Unknown Source) 
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
at com.google.firebase.FirebaseApp.zzbu(Unknown Source) 
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723) 
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
(...)
I had the same problem and I found a mistake done by me in my Firebase console.
One of the reason for this problem could be, your Sign In Method inside Firebase > Auth Dashboard might be disabled.
I just enabled it and it started working.
Can you check your Google Play Services version?
From Firebase oficial website:
Prerequisites
An Android device running Google Play services 9.0.0 or later
The Google Play services SDK from the Android SDK Manager
Android Studio 1.5 or higher
An Android Studio project and its package name.
Very sad that Firebase initialization errors are so not straightforward, so developers need to guess what went wrong. In my case I imported only:
compile 'com.google.firebase:firebase-auth:10.2.0'
and forgot to import also core:
compile 'com.google.firebase:firebase-core:10.2.0'
Maybe it will help someone, good luck!
I found the issue. The issue was the first prerequisite Guilherme mentioned, but not the boldfaced part.. Although your dependencies also need to explicitly state 9.+ of the play services part, the devices itself also needs to have 9.+ installed. Debugging on my phone works fine and updating the image of my emulator solves the issue there as well.
Disabling Instant Run worked for me. Sounds ridiculous, I know. I tried cleaning the project. I tried uninstalling/reinstalling the app. The thing that finally did the trick was disabling Instant Run. sigh
I logged out and then logged in and it solved this problem for me.
Probably from some kind of synchronization the FB stuff have not implemented.
If this problem consist I will try to intercept it. But reallly, this is a bug in Firebase system. And It is a bug that is caused by more than one use case, which is another issue on its own.
You can check out while adding google sign in option
Before we use
GoogleSignInOptions gso = new GoogleSignInOptions
.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();
add one line as show in the following code
GoogleSignInOptions gso = new GoogleSignInOptions
.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
after adding this if you get the error like
An internal error has occured. [ Invalid Idp Response: id_token audience mismatch. ]
then Click here to get solution this works for me.
If you just want to use the Firebase authentication and you got here because of the error:
Didn't find class
"com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.ModuleDescriptor"
Go to https://console.firebase.google.com/project/[your project]/authentication/providers and enable the authentication providers you support.
I had similar issue with signup the user but finally found a working solution.
Uninstall the HAXM and reinstall it solves my issue and it successfully signup's the user to firebase auth :)
This answer on another question made my app authenticate
Alfonso Gomez Jordana Manas
Hello Pierre,
You have to manually whitelist your existing Google OAuth 2.0 client IDs in the Firebase console before using it with the new Auth APIs.
In order to do so, follow these steps:
Go to the Credentials section in the Google API Console.
Select from the top right corner the project where you had previously configured Google Sign-In.
Go to the OAuth 2.0 client IDs section
If you are using Google Sign-In on Android or iOS applications:
Take note of the Client ID string corresponding to all the entries registered for your applications.
Input these Client IDs into your Firebase project’s configuration:
Go to the Firebase console at https://console.firebase.google.com
Open the Auth section
Under Sign-In methods, open the Google configuration, and add all your client IDs to the whitelist of client IDs from external projects.
If you are using Google Sign-In on a web application:
Click to open your web client ID and take note of both the client ID and secret.
Input this Client ID into your Firebase project’s configuration:
Go to the Firebase console at https://console.firebase.google.com
Open the Auth section
Under Sign-In methods, open the Google configuration, and add the values under the Web SDK configuration section.
Let me know if this resolves your issue.
if you do everything but you got nothing try to update your ARM EABI.
Google APIs ARM EABI v7a System Image
If your emulator has not new goggle updates you will get always auth error.
Do everything suggested in this post then update ARM EABI image.
This solved my problem.
It may also happen when you don't have the SHA1 fingerprints registered in Firebase and in Google API. There in both of them must register two fingerprints: from the debug keystore and from the production keystore (generated when you create the project's apk for the first time when you enter some password keys on Android Studio).
Here shows how to get the SHA1 from there.
or run this command on C:\Users\<user name>\.android directory.
keytool -list -v -keystore debug.keystore
Sharing my experience:
I faced the same issue, I googled everywhere but couldn't find the exact answer, even if I was doing everything as documented by Google Android documentation. Suddenly after a day, my app was working fine and at that same moment I got the email from google stating "Google APIs Explorer connected to your Google Account". And it looks to me that google takes time to grant us access, just wait for this email, maybe this issue is not related to bad code.

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?
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?
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.)
It is a weird bug, I solved this problem by this way - just changed android:value="#integer/google_play_services_version" to 3265130.
Create an integer resource seems to solve the problem.
But I ended up bumping into each other.
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/
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.

Categories

Resources