collect icon indicating copy to clipboard operation
collect copied to clipboard

Adding second account breaks Google Drive

Open nribeka opened this issue 9 years ago • 13 comments

Software and hardware versions

Collect v1.4.16, Android 6.0, Moto X Pure

Problem description

When I add a second gmail account, the collect break with NPE.

Steps to reproduce the problem

  • Ensure your google account is not connected to ODK yet: Google Account Permissions (If you have not visited this in a while, now is a good time to go through it).
  • In general settings, change the platform to "Google Drive, Google Sheets"
  • Select your primary gmail account for the google account.
  • Go to get blank form section and press "My Drive"
  • It will ask you to allow Collect to access your drive.
  • Add a second gmail account to your phone: Add Account.
  • Change your google account in the general settings to the new account.
  • Go to the get blank form section and press "My Drive" and Collect will crash.
  • Adding a third gmail account strangely make Collect work again.

Expected behavior

Collect should allow adding the second account without crashing.

Other information

This might not even be issue on the Collect side.

nribeka avatar Mar 24 '17 17:03 nribeka

@nribeka Can you add a stack trace please?

lognaturel avatar Mar 24 '17 17:03 lognaturel

The error logs similar to this, I'm getting this from the master branch:

03-24 13:38:42.171 15916-15982/org.odk.collect.android E/GoogleDriveActivity: null
    com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAuthIOException
    at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:301)
    at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:868)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
    at org.odk.collect.android.activities.GoogleDriveActivity$RetrieveDriveFileContentsAsyncTask.doInBackground(GoogleDriveActivity.java:790)
    at org.odk.collect.android.activities.GoogleDriveActivity$RetrieveDriveFileContentsAsyncTask.doInBackground(GoogleDriveActivity.java:765)
    at android.os.AsyncTask$2.call(AsyncTask.java:295)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
    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)
Caused by: com.google.android.gms.auth.GoogleAuthException: Unknown
    at com.google.android.gms.auth.zze$1.zzat(Unknown Source)
    at com.google.android.gms.auth.zze$1.zzau(Unknown Source)
    at com.google.android.gms.auth.zze.zza(Unknown Source)
    at com.google.android.gms.auth.zze.zzc(Unknown Source)
    at com.google.android.gms.auth.zze.getToken(Unknown Source)
    at com.google.android.gms.auth.zze.getToken(Unknown Source)
    at com.google.android.gms.auth.zze.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:269)
    at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:294)
    at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:868) 
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419) 
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352) 
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469) 
    at org.odk.collect.android.activities.GoogleDriveActivity$RetrieveDriveFileContentsAsyncTask.doInBackground(GoogleDriveActivity.java:790) 
    at org.odk.collect.android.activities.GoogleDriveActivity$RetrieveDriveFileContentsAsyncTask.doInBackground(GoogleDriveActivity.java:765) 
    at android.os.AsyncTask$2.call(AsyncTask.java:295) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
    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) 
03-24 13:38:42.171 15916-15982/org.odk.collect.android E/drive: Error occurred : Unable to fetch drive contents

nribeka avatar Mar 24 '17 17:03 nribeka

@lognaturel I think the best way to try to reproduce this issue is using accounts that never connect to Collect before.

nribeka avatar Mar 24 '17 17:03 nribeka

@nribeka I tried running the app on Nexus 5 Android 6 by following the steps that you mentioned but could not be able to produce any error.

lakshyagupta21 avatar Mar 24 '17 19:03 lakshyagupta21

@lakshyagupta21 have you ever connect your Collect to your drive before and did you remove ODK from your authorized application? I can get this somewhat consistently (sometimes I can get to the Drive).

nribeka avatar Mar 24 '17 19:03 nribeka

Yeah i connected once but i removed ODK from authorized applications and tested for my other 4 accounts as well which are not connected with ODK before.

lakshyagupta21 avatar Mar 24 '17 19:03 lakshyagupta21

Created a new account and wasn't able to reproduce this on physical Nexus 5, Android 6.0.1. @nribeka Did you only get it with a new account or also with an existing account that you've revoked authorization for? When you get the failure, what happens if you relaunch Collect and try again?

lognaturel avatar Mar 24 '17 21:03 lognaturel

@lognaturel @nribeka I wasn't able to reproduce this issue as well.

grzesiek2010 avatar Mar 24 '17 23:03 grzesiek2010

Hi all!. I also wasn't able to reproduce the bug

shobhitagarwal1612 avatar Mar 27 '17 11:03 shobhitagarwal1612

@nribeka Are you still able to reproduce it?

lognaturel avatar Mar 27 '17 13:03 lognaturel

Seems to be working this time @lognaturel. I think we can close it for now?

nribeka avatar Mar 27 '17 13:03 nribeka

Cool! I think #767 may have also addressed it.

lognaturel avatar Mar 27 '17 13:03 lognaturel

Oops, #776 rather.

lognaturel avatar Mar 27 '17 13:03 lognaturel