Google Drive API – the name must not be empty: null (But I had passed valid account name to GoogleAccountCredential)

It looks like the Drive API Client Library for Java calls into GoogleAuthUtil.getToken(), which requires the GET_ACCOUNTS permission. You need to have that permission in your manifest and request it at runtime, as appropriate.

UPDATE:
With Google Drive REST v3 API, GET_ACCOUNTS permission is not required. Instead, Email permission is required. You can ask for it by calling GoogleSignInOptions.Builder.requestEmail.

Leave a Comment