Obsolete
Status Update
Comments
mo...@google.com <mo...@google.com> #3
There is a bug in our checks that is sometimes throwing this SecurityException when there is a network error to authenticate. The fix will rollout in the next version of Google Play services.
For now, the best workaround would be set up an UncaughtExceptionHandler on the thread that you call GoogleApiClient.connect(). For most folks, this would be on the main thread, which you can get via Looper.myLooper().getThread().
For now, the best workaround would be set up an UncaughtExceptionHandler on the thread that you call GoogleApiClient.connect(). For most folks, this would be on the main thread, which you can get via Looper.myLooper().getThread().
pr...@iiitb.net <pr...@iiitb.net> #4
is the workaround suggested above is adding this code ?
Looper.myLooper().getThread().setUncaughtExceptionHandler(new UncaughtExceptionHandler()
{
@Override
public void uncaughtException(Thread thread, Throwable ex)
{
// log the exception
}
});
assuming googleApiClient.connect(); is called on main thread in service ?
Looper.myLooper().getThread().setUncaughtExceptionHandler(new UncaughtExceptionHandler()
{
@Override
public void uncaughtException(Thread thread, Throwable ex)
{
// log the exception
}
});
assuming googleApiClient.connect(); is called on main thread in service ?
[Deleted User] <[Deleted User]> #5
#3, here is the code I have :
public class GoogleApiFixUncaughtExceptionHandler implements Thread.UncaughtExceptionHandler {
private final Thread.UncaughtExceptionHandler mWrappedHandler;
public GoogleApiFixUncaughtExceptionHandler(Thread.UncaughtExceptionHandler wrappedHandler) {
mWrappedHandler = wrappedHandler;
}
@Override public void uncaughtException(Thread t, Throwable e) {
if (e instanceof SecurityException &&
e.getMessage().contains("Invalid API Key for package")) {
Debug.log_w(DebugConfig.DEFAULT, "google error");
Crashlytics.logException(e);
return;
}
// resend the exception
mWrappedHandler.uncaughtException(t, e);
}
}
-------------------------------------------------------------------
Thread thread = Thread.currentThread();
Thread.UncaughtExceptionHandler wrapped = thread.getUncaughtExceptionHandler();
if (!(wrapped instanceof GoogleApiFixUncaughtExceptionHandler)) {
GoogleApiFixUncaughtExceptionHandler handler = new GoogleApiFixUncaughtExceptionHandler(wrapped);
thread.setUncaughtExceptionHandler(handler);
}
googleApiClient.registerConnectionCallbacks(connectionCallbacks);
googleApiClient.registerConnectionFailedListener(connectionFailedListener);
googleApiClient.connect();
--------------------------------
This has not been QA-ed yet though, so a confirmation from Google that this will work would be nice.
public class GoogleApiFixUncaughtExceptionHandler implements Thread.UncaughtExceptionHandler {
private final Thread.UncaughtExceptionHandler mWrappedHandler;
public GoogleApiFixUncaughtExceptionHandler(Thread.UncaughtExceptionHandler wrappedHandler) {
mWrappedHandler = wrappedHandler;
}
@Override public void uncaughtException(Thread t, Throwable e) {
if (e instanceof SecurityException &&
e.getMessage().contains("Invalid API Key for package")) {
Debug.log_w(DebugConfig.DEFAULT, "google error");
Crashlytics.logException(e);
return;
}
// resend the exception
mWrappedHandler.uncaughtException(t, e);
}
}
-------------------------------------------------------------------
Thread thread = Thread.currentThread();
Thread.UncaughtExceptionHandler wrapped = thread.getUncaughtExceptionHandler();
if (!(wrapped instanceof GoogleApiFixUncaughtExceptionHandler)) {
GoogleApiFixUncaughtExceptionHandler handler = new GoogleApiFixUncaughtExceptionHandler(wrapped);
thread.setUncaughtExceptionHandler(handler);
}
googleApiClient.registerConnectionCallbacks(connectionCallbacks);
googleApiClient.registerConnectionFailedListener(connectionFailedListener);
googleApiClient.connect();
--------------------------------
This has not been QA-ed yet though, so a confirmation from Google that this will work would be nice.
de...@gmail.com <de...@gmail.com> #6
Great news, that there's a fix on the horizon. Can you share a rough timeline for the release of the next Play Services Version?
fr...@gmail.com <fr...@gmail.com> #8
At #6 : what makes you think that this version contains the fix?
[Deleted User] <[Deleted User]> #9
> The fix will rollout in the next version of Google Play services.
does this mean version 9.8.0 that has just finished its rollout ?
Or is it going to be in the next version ? If so, what is the time frame ?
>For now, the best workaround would be set up an UncaughtExceptionHandler on the thread that you call GoogleApiClient.connect(). For most folks, this would be on the main thread, which you can get via Looper.myLooper().getThread().
It just makes the whole app freeze :/
Not only it is a dirty fix, it also does not work reliably.
does this mean version 9.8.0 that has just finished its rollout ?
Or is it going to be in the next version ? If so, what is the time frame ?
>For now, the best workaround would be set up an UncaughtExceptionHandler on the thread that you call GoogleApiClient.connect(). For most folks, this would be on the main thread, which you can get via Looper.myLooper().getThread().
It just makes the whole app freeze :/
Not only it is a dirty fix, it also does not work reliably.
de...@gmail.com <de...@gmail.com> #10
Hmmm... #7, you are right. The conclusion that 9.8.0 contained the fix sadly wasn't correct. I currently see the Exception in the wild with Play Service 9.8.0
fr...@gmail.com <fr...@gmail.com> #11
#9 too bad :/
I really hope that we will get a fix, right now awareness is dead in the water if we get random crashes with it.
I really hope that we will get a fix, right now awareness is dead in the water if we get random crashes with it.
mo...@google.com <mo...@google.com> #12
Unfortunately, the version that contains this fix won't be out until early next year.
#8, the code you posted in #3 looks correct, but you indicated that the app freezes. If you catch the SecurityException, then you can retry googleApiClient.connect(), assuming that you have enabled the Awareness API in the Google Developer Console.
#8, the code you posted in #3 looks correct, but you indicated that the app freezes. If you catch the SecurityException, then you can retry googleApiClient.connect(), assuming that you have enabled the Awareness API in the Google Developer Console.
[Deleted User] <[Deleted User]> #13
#11 : I mean that the whole application freezes and fail to load its UI. It looks like catching this exception is not enough to make
So I can't make the app recover from that.
Do you have other suggestions ? I have still one thing or two to try on my end, but it is starting to look like we will just have to drop awareness altogether.
We can't ship an app that randomly crashes.
So I can't make the app recover from that.
Do you have other suggestions ? I have still one thing or two to try on my end, but it is starting to look like we will just have to drop awareness altogether.
We can't ship an app that randomly crashes.
pr...@iiitb.net <pr...@iiitb.net> #14
#12 do you know a reliable way to reproduce this ? I am not able to reproduce this on my devices, even if i make any fix until i reproduce the issue i will not able to test.
#11 if i am using only activity detection from awareness api can i switch back to old standalone activity detection ? i am assuming both are same and awareness api is just wrapping the old api along with other things it has to offer ?
#11 if i am using only activity detection from awareness api can i switch back to old standalone activity detection ? i am assuming both are same and awareness api is just wrapping the old api along with other things it has to offer ?
[Deleted User] <[Deleted User]> #15
#13 unfortunately no. I can always throw a SecurityException myself just after the call to connect, but I am unsure it is a good reproduction of the crash.
I tried to alter the awareness key in my manifest in order to force the lib to throw a SecurityException. Unfortunately, play services seems to cache the value after the first check, it just runs normally.
I tried to alter the awareness key in my manifest in order to force the lib to throw a SecurityException. Unfortunately, play services seems to cache the value after the first check, it just runs normally.
te...@gmail.com <te...@gmail.com> #16
#2 Does the bug always report the same Status code (-1)? In my app I see some exceptions in the wild but the ".Status code received = 6"
So, could my problem be the same as the one reported in this bug?
So, could my problem be the same as the one reported in this bug?
y1...@lnmiit.ac.in <y1...@lnmiit.ac.in> #17
Apparently, creating a new API key solved the problem for me. I was getting the error with Status code received = 6
js...@gmail.com <js...@gmail.com> #18
I've tried the #3 workaround and I've tried to use a new API key and we're still randomly seeing this crash. We're running GPS 10.0.1. Just going to turn off the Awareness API until this has been resolved.
de...@gmail.com <de...@gmail.com> #19
Any updates on the timeline of the fix?
da...@google.com <da...@google.com> #20
The fix for this issue has been rolled out with Google Play Services version 10.2.xx or later, and all devices should have received this update starting 2/9.
You should not see this security exception anymore on devices that have received the update.
You should not see this security exception anymore on devices that have received the update.
[Deleted User] <[Deleted User]> #21
Still have this issue...
I use the most recent play-services-awareness-10.2.0, GPS on my device is also updated.
I use the most recent play-services-awareness-10.2.0, GPS on my device is also updated.
da...@gmail.com <da...@gmail.com> #22
In my case I was getting the error with Status code received = 12.
In the API Console I changed the Awareness API Key Retriction permission to "None" (I don't know if it's none, I use the Console in spanish).
I just declared then my client as always:
client = new GoogleApiClient.Builder(context)
.addApi(Awareness.API)
.build();
client.registerConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
Log.e("Google Connection", connectionResult.getErrorMessage());
}
});
client.connect();
Hope this help someone. I spent two days in this issue.
Cheers.
In the API Console I changed the Awareness API Key Retriction permission to "None" (I don't know if it's none, I use the Console in spanish).
I just declared then my client as always:
client = new GoogleApiClient.Builder(context)
.addApi(Awareness.API)
.build();
client.registerConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
Log.e("Google Connection", connectionResult.getErrorMessage());
}
});
client.connect();
Hope this help someone. I spent two days in this issue.
Cheers.
fi...@gmail.com <fi...@gmail.com> #23
I had the same issue with Status code 12 and changing the permission to "None" instead of android apps, fixed the issue for me too.
js...@gmail.com <js...@gmail.com> #24
I updated our API Keys to Restriction of "None" over a week ago, but today I'm still getting a java.lang.SecurityException: Invalid API Key for package = com.autotrader.android .Status code received = 12
We're running: 'com.google.android.gms:play-services-awareness:10.2.0'
We're running: 'com.google.android.gms:play-services-awareness:10.2.0'
pr...@iiitb.net <pr...@iiitb.net> #25
Hi,
Since last 3-4 days, we started seeing the Parcel exception again. This was fixed earlier but i believe with recent play services update it started again. This is the error we get "Parcel android.os.Parcel@4e91c444: Unmarshalling unknown type code 7274595 at offset 248"
This time it is happening at LocationResult.hasResult method
Since last 3-4 days, we started seeing the Parcel exception again. This was fixed earlier but i believe with recent play services update it started again. This is the error we get "Parcel android.os.Parcel@4e91c444: Unmarshalling unknown type code 7274595 at offset 248"
This time it is happening at LocationResult.hasResult method
az...@gmail.com <az...@gmail.com> #26
i have the same proble with this Invalid API Key for package = com.autotrader.android .Status code received = 12
pa...@google.com <pa...@google.com>
to...@repsly.com <to...@repsly.com> #27
I have in Gradle: compile 'com.google.android.gms:play-services-awareness:10.2.0'
This issue still happening for my build. Any solutions in the nearby future?
This issue still happening for my build. Any solutions in the nearby future?
[Deleted User] <[Deleted User]> #28
I have in Gradle: compile 'com.google.android.gms:play-services-awareness:10.2.6'
Still no luck :( SecurityError, status code = 12
Still no luck :( SecurityError, status code = 12
pa...@google.com <pa...@google.com> #29
Status code 12 corresponds to server rejection of API key and should not automatically be attributed to an Awareness issue. This can be because of incorrectly set-up key/packageId pair, or e.g. if some quota is reached (currently, in addition to daily quotas, there is a quota of 1000 queries per 100 seconds per user).
ia...@gmail.com <ia...@gmail.com> #30
I've spent an entire day attempting to work around this issue. None of the causes listed in post #29 apply, as the key has no restrictions in the developer console, and I've tried with different keys from different accounts, none with any restriction, and there was zero activity such that it is not related to quota. This also means it cannot be a problem with the packageId. Moreover, I've tried different API versions and on a second computer - still the same problem. Lastly, status code 12, which is simply referred to as "unknown status code" using getStatusCodeString(12) is absent from the documentation, https://developers.google.com/android/reference/com/google/android/gms/common/api/CommonStatusCodes ?
The workaround code provided in post #4 catches the problem, but the app becomes unresponsive and freezes. Is there any way to fix this, or an update, considering this was posted almost a year ago?
Please do something about this, as it renders the API completely unavailable!
The workaround code provided in post #4 catches the problem, but the app becomes unresponsive and freezes. Is there any way to fix this, or an update, considering this was posted almost a year ago?
Please do something about this, as it renders the API completely unavailable!
dj...@echosense.in <dj...@echosense.in> #31
This issue makes awareness API unusable for any serious application. Is there a plan to fix this that can be shared publicly?
dj...@echosense.in <dj...@echosense.in> #32
Also is there a way to bump up priority and severity of this issue?
ma...@google.com <ma...@google.com> #33
This issue was expected to have been fixed (per comment #20 ), it is unfortunate that there continue to be some recent reports. dj@echosense.in - would you mind sharing a bug report after you reproduce the issue to help identify the root cause?
dj...@echosense.in <dj...@echosense.in> #34
Bug report is attached The stacktrace is -
07-18 14:28:06.252 22115 22115 E AndroidRuntime: FATAL EXCEPTION: main
07-18 14:28:06.252 22115 22115 E AndroidRuntime: Process: com.example.shudluckrajput.awarenessapitest, PID: 22115
07-18 14:28:06.252 22115 22115 E AndroidRuntime: java.lang.SecurityException: Invalid API Key for package = com.example.shudluckrajput.awarenessapitest. Status code received = 12
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:1472)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:1426)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at com.google.android.gms.common.internal.zzu$zza$zza.zza(Unknown Source)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at com.google.android.gms.common.internal.zzd.zza(Unknown Source)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at com.google.android.gms.internal.zzpw$zzc.zzapl(Unknown Source)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at com.google.android.gms.internal.zzpw$zzf.run(Unknown Source)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at com.google.android.gms.internal.zzrn.run(Unknown Source)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at java.lang.Thread.run(Thread.java:841)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: FATAL EXCEPTION: main
07-18 14:28:06.252 22115 22115 E AndroidRuntime: Process: com.example.shudluckrajput.awarenessapitest, PID: 22115
07-18 14:28:06.252 22115 22115 E AndroidRuntime: java.lang.SecurityException: Invalid API Key for package = com.example.shudluckrajput.awarenessapitest. Status code received = 12
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:1472)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:1426)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at com.google.android.gms.common.internal.zzu$zza$zza.zza(Unknown Source)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at com.google.android.gms.common.internal.zzd.zza(Unknown Source)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at com.google.android.gms.internal.zzpw$zzc.zzapl(Unknown Source)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at com.google.android.gms.internal.zzpw$zzf.run(Unknown Source)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at com.google.android.gms.internal.zzrn.run(Unknown Source)
07-18 14:28:06.252 22115 22115 E AndroidRuntime: at java.lang.Thread.run(Thread.java:841)
bo...@gmail.com <bo...@gmail.com> #35
it so idiotic (( I've spent 2 days and can't fix this problem , exception handler didn't help.
[175] BasicNetwork.performRequest: Unexpected response code 403 forhttps://www.googleapis.com/usercontext/v1/controllerhub/ping
08-01 22:09:58.330 2009-2009/? E/ctxmgr: [BaseServerTask]Server task (PingTask) got error statusCode=403.
com.android.volley.AuthFailureError
at com.android.volley.toolbox.BasicNetwork.performRequest(:com.google.android.gms@11503438:33)
at mgz.performRequest(:com.google.android.gms@11503438:4)
at com.android.volley.NetworkDispatcher.run(:com.google.android.gms@11503438:12)
08-01 22:09:58.334 2009-762/? E/ctxmgr: [ContextManager3PCredentialsVerifier]Failed ping response: network status=12
08-01 22:09:58.336 2009-2625/? E/AbstractServiceBroker: Getting service failed
java.lang.SecurityException: Invalid API Key for package =com.cargotrack.app . Status code received = 12
at cnm.a(:com.google.android.gms@11503438:23)
at cnp.a(:com.google.android.gms@11503438:36)
at lzh.a(:com.google.android.gms@11503438:42)
at mbv.onTransact(:com.google.android.gms@11503438:9)
at android.os.Binder.transact(Binder.java:499)
at buy.onTransact(:com.google.android.gms@11503438:3)
at android.os.Binder.execTransact(Binder.java:565)
[175] BasicNetwork.performRequest: Unexpected response code 403 for
08-01 22:09:58.330 2009-2009/? E/ctxmgr: [BaseServerTask]Server task (PingTask) got error statusCode=403.
com.android.volley.AuthFailureError
at com.android.volley.toolbox.BasicNetwork.performRequest(:com.google.android.gms@11503438:33)
at mgz.performRequest(:com.google.android.gms@11503438:4)
at com.android.volley.NetworkDispatcher.run(:com.google.android.gms@11503438:12)
08-01 22:09:58.334 2009-762/? E/ctxmgr: [ContextManager3PCredentialsVerifier]Failed ping response: network status=12
08-01 22:09:58.336 2009-2625/? E/AbstractServiceBroker: Getting service failed
java.lang.SecurityException: Invalid API Key for package =
at cnm.a(:com.google.android.gms@11503438:23)
at cnp.a(:com.google.android.gms@11503438:36)
at lzh.a(:com.google.android.gms@11503438:42)
at mbv.onTransact(:com.google.android.gms@11503438:9)
at android.os.Binder.transact(Binder.java:499)
at buy.onTransact(:com.google.android.gms@11503438:3)
at android.os.Binder.execTransact(Binder.java:565)
bo...@gmail.com <bo...@gmail.com> #36
I have in Gradle: compile 'com.google.android.gms:play-services-awareness:11.0.4' problem exist
zs...@gmail.com <zs...@gmail.com> #37
I see the same, lots of crashing session with status code 12.
Just migrated to Awereness API from legacy geofencing + I'm using the Snapshot API to get the current location.
Play store lib version 11.2.2
Any update on when can we expect a fix for it?
Do we have any stable workaround?
Just migrated to Awereness API from legacy geofencing + I'm using the Snapshot API to get the current location.
Play store lib version 11.2.2
Any update on when can we expect a fix for it?
Do we have any stable workaround?
vi...@usfx.bo <vi...@usfx.bo> #38
Any update on when can we expect a fix for it?
uv...@gmail.com <uv...@gmail.com> #39
I just started getting this exception today in an app that has been using Awareness successfully for a while. It's been a year since the previous post. Any updates?
uv...@gmail.com <uv...@gmail.com> #40
Never mind! I just realized that I am on a new machine with a different debug keystore. Added the fingerprint to the API and now it works again.
sa...@google.com <sa...@google.com> #41
Thank you for your feedback. We have tried our best to address the issue reported, however our product team has shifted work priority which doesn't include this issue. For now, we will be closing the issue as "Won't Fix (Obsolete)". If this issue still currently exists, we request that you log a new issue along with the latest bug report here: https://goo.gl/TbMiIO and reference this bug for context.
Description
We are running into some issues while using the Awareness API on Android.
On all in-house test devices everything runs fine with debug and release builds. However, for some users out there we get crash reports that indicate a problem with the API:
Fatal Exception: java.lang.SecurityException: Invalid API Key for package = de.stocard.stocard .Status code received = -1
at android.os.Parcel.readException(Parcel.java:1620)
at android.os.Parcel.readException(Parcel.java:1573)
at com.google.android.gms.common.internal.zzu$zza$zza.zza(Unknown Source)
at com.google.android.gms.common.internal.zzd.zzqz(Unknown Source)
at com.google.android.gms.internal.zzpw$zzc.zzapl(Unknown Source)
at com.google.android.gms.internal.zzpw$zzf.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at com.google.android.gms.internal.zzrn.run(Unknown Source)
at java.lang.Thread.run(Thread.java:818)
This happens on Android versions ranging from 4.4.2 to 7.0 with no noticeable pattern.
The same applies to the device model and manufacturer: many and multiple manufacturers and models.
We interface with the Awareness AP fromI inside a GcmTaskService.
This stackoverflow post from another developer outlines a very similar problem: