4

I have been trying to add Google Drive(v2) into my Android application and I can’t get past authorization. I have been getting UserRecoverableAuthIOException, with the message “NeedPermission.” I have a feeling that there is something wrong with my Client ID on Google API Console, but I thought I should post here to see if anyone could shed some light on my situation.

I have implemented the Drive Quickstart for Android, and I ran DrEdit with no problems. (https://developers.google.com/drive/quickstart-android and https://developers.google.com/drive/examples/android)

The only real difference between my application and the sample/example applications is that the Google Drive code would be in a library project, so I tried the following:

I created a project with a package name (Let’s call it com.example.googledrivetest), that had the Android Quickstart code. This ran perfectly.

Then, I made this project into a Library Project, and changed the package name (Let’s call this com.example.googledrivetestlibrary), and made a project with “com.example.googledrivetest” as the package name. This new project called the library project. Running this new project worked correctly as well!

So, I tried moving the code that was getting the UserRecoverableAuthException in the other project into the library project (since, it was working). To my surprise, it worked perfectly.

Now, both “com.example.googledrivetest” and my other application (with the exception) are both registered on Google Console APIs’ API Access. So I tried changing “com.example.googledrivetest” to “, and then it started getting the UserRecoverableAuthIOException. If I changed it back to “com.example.googledrivetest,” it worked again.

So, I was wondering if there is anything I am doing wrong, or need to add to my code to get it to work.

4

0 回答 0