5

My app has started crashing during the google sign in process.

It wasn't crashing like this before.

Could it be connected to changing the Google Play services version?

What else could cause this crash?

I was able to stop it before by delaying when I implement my OneSignal initialization in the Application class. But, I am not sure how they are connected and have only come across the connection because of trial and error. Changing my OneSignal implementation doesn't seem like a proper solution as it sidesteps a problem that wasn't occurring before and may occur again if I don't find a more specific cause for it.

Also, the crash doesn't always occur during the sign in process.

The main clues from the logcat seem to be:

 An error occurred while executing doInBackground()
Caused by: java.util.ConcurrentModificationException
at com.google.android.gms.auth.api.signin.internal.zzb.zzafx(Unknown Source)
at com.google.android.gms.auth.api.signin.internal.zzb.loadInBackground(Unknown Source)

Here is the full logcat:

UncaughtException: java.lang.RuntimeException: An error occurred while executing doInBackground()
                                                                                                    at android.support.v4.content.ModernAsyncTask$3.done(ModernAsyncTask.java:142)
                                                                                                    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
                                                                                                    at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
                                                                                                    at java.util.concurrent.FutureTask.run(FutureTask.java:242)
                                                                                                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                                                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                                                    at java.lang.Thread.run(Thread.java:818)
                                                                                                 Caused by: java.util.ConcurrentModificationException
                                                                                                    at java.util.WeakHashMap$HashIterator.next(WeakHashMap.java:165)
                                                                                                    at com.google.android.gms.auth.api.signin.internal.zzb.zzafx(Unknown Source)
                                                                                                    at com.google.android.gms.auth.api.signin.internal.zzb.loadInBackground(Unknown Source)
                                                                                                    at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:296)
                                                                                                    at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:54)
                                                                                                    at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:42)
                                                                                                    at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:128)
                                                                                                    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                                                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
                                                                                                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
                                                                                                    at java.lang.Thread.run(Thread.java:818) `11-11 00:35:53.023 11247-11903/com.example.package E/AndroidRuntime: FATAL EXCEPTION: ModernAsyncTask #1
                                                                                             Process: com.example.package, PID: 11247
                                                                                             java.lang.RuntimeException: An error occurred while executing doInBackground()
                                                                                                 at android.support.v4.content.ModernAsyncTask$3.done(ModernAsyncTask.java:142)
                                                                                                 at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
                                                                                                 at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
                                                                                                 at java.util.concurrent.FutureTask.run(FutureTask.java:242)
                                                                                                 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                                                 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                                                 at java.lang.Thread.run(Thread.java:818)
                                                                                              Caused by: java.util.ConcurrentModificationException
                                                                                                 at java.util.WeakHashMap$HashIterator.next(WeakHashMap.java:165)
                                                                                                 at com.google.android.gms.auth.api.signin.internal.zzb.zzafx(Unknown Source)
                                                                                                 at com.google.android.gms.auth.api.signin.internal.zzb.loadInBackground(Unknown Source)
                                                                                                 at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:296)
                                                                                                 at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:54)
                                                                                                 at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:42)
                                                                                                 at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:128)
                                                                                                 at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                                                 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
                                                                                                 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
                                                 `                                                at java.lang.Thread.run(Thread.java:818)

Thanks in advance.

Micah Simmons
  • 2,078
  • 2
  • 20
  • 38
  • I don't see OneSignal in your stack trace so I don't believe this is the issue. Can you try uploading the GMS / Google Play services library to 9.8.0? – jkasten Nov 11 '16 at 02:51
  • The error [`java.util.ConcurrentModificationException`](https://docs.oracle.com/javase/7/docs/api/java/util/ConcurrentModificationException.html) means that this exception may be thrown by methods that have detected concurrent modification of an object when such modification is not permissible. Usually this kind of error use `Iterator` to resolve. Check this [SO question](http://stackoverflow.com/questions/18448671) on how to do that. For more information, check this [thread](http://www.programcreek.com/2014/01/java-util-concurrentmodificationexception/). – KENdi Nov 11 '16 at 11:28
  • @jkasten Thanks for your response. OneSignal isn't in the stack trace, but, if I initialise OneSignal in the onCreate method of the Application class at the point where a user is choosing their Gmail account when they're first signing-in then the app crashes at least around 1 in 4 times. However, by stopping the OneSignal initialization it stopped crashing during that first registration process. However, it has crashed once during the sign-in process post the user's initial sign-in. And the error still occurs using version 9.8.0 of the Google Play services. – Micah Simmons Nov 11 '16 at 12:25
  • @Kendi Thanks for your response. The error wasn't occurring before. No for loops or iterators are being executed in the code that I have written at the time that the crash occurs. – Micah Simmons Nov 11 '16 at 12:36
  • Same crash for me, OneSignal + GMS v10.0.1, but only on specific devices. OneSignal initialized in Application `onCreate` but still crash – Dmytro Rostopira Feb 13 '17 at 18:34

0 Answers0