CmosBattery
CmosBattery

Reputation: 954

Google Drive via OAuth release version receives dailyLimitExceededUnreg

I simply cannot get my way past this one. The error and related searches do nothing to fix it.

I'm coming from the Drive Android API which was working fine. Google in ending that soon and had to switch to OAuth Drive implementation.

Anyway, all works 100% in debug apk for months now.

Release apk receives

**    "domain": "usageLimits",
      "reason": "dailyLimitExceededUnreg",
      "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
      "extendedHelp": "https://code.google.com/apis/console"**

Now, remember I have all this setup previously using Drive Android API and made the required changes for the other API, in cloud console, etc.

The consent screen is verified.

Adding a key to the code connections doesn't work but it only breaks debug instead if I try to make it more secure in the cloud console by limiting it only to the app.

Using token doesn't seem to work either.

Waiting for 24 hours doesn't work.

I can't figure out what signup is referring to but unless its paid, I don't see anything else that can be done.

And it didn't hit any actual limit as the cloud console shows.

As you can tell, I'm really confused by this horrible error message lol.

Upvotes: 0

Views: 621

Answers (1)

CmosBattery
CmosBattery

Reputation: 954

Frustrated and still throwing things at it but tracked it down to ProGuard causing the problem during creation of signed apk.

Why can't Google get this stuff straight in the docs....


Edit

Key, token, etc isn't needed using Drive Rest API and OAuth...

With, ProGuard in use, just need to use maybe one or two or all three of the following. I'm too frustrated at the moment to narrow it down more:

-keep class * extends com.google.api.client.json.GenericJson { *; }
-keep class com.google.api.services.drive.** { *; }
-keepclassmembers class * { @com.google.api.client.util.Key <fields>; }

The error isn't listed in the link for example so it doesn't pop up in search results: Google Drive Api v3 and proguard (I added one extra)

What I have that works is:

1) Using a cloud console provided project # in manifest with meta-data and intent-filter. https://developers.google.com/drive/android/java-client#set_mime_types_in_the_app_manifest

2) The gradle stuff for Drive. I have this listed for that:

// GOOGLE DRIVE API (as of 6/22/19)
implementation 'com.google.http-client:google-http-client-gson:1.26.0'
implementation('com.google.api-client:google-api-client-android:1.26.0') {
    exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.apis:google-api-services-drive:v3-rev136-1.25.0') {
    exclude group: 'org.apache.httpcomponents'
}

3) And the Drive rest API examples found from Google for sign-in, file upload, download, deletion, etc. etc. that don't included keys or token use (though done my way). https://developers.google.com/drive/android/auth eg sign-in. https://github.com/gsuitedevs/android-samples/blob/master/drive/deprecation/app/src/main/java/com/google/android/gms/drive/sample/driveapimigration/DriveServiceHelper.java eg creating files, etc.

4) Cloud console OAuth screen (verified - when you verify Google will tell you if something is wrong as they help you to gain verification) and credentials along with Drive API enabled. For credentials: https://developers.google.com/drive/android/auth eg OAuth client ID with Android selected (if you already have that then no need to change).

5) The ProGuard fix

And I think that was it. There's stuff all over the place (including other things that I'm not getting into) but that's Google for you. Stupidly complex just to use Drive again when it was fine already lol.

Also note that you may have serious code changes ahead of you as well for those switching from Drive Android API. See the file creation, etc link above for why it may be different than it was with Android Drive API. I did the long haul of changing all the code which was substantial including bug fixing and testing as I couldn't find a way to keep it the same. A fun time that was. As a result though I fixed some problems and improved things that I didn't see or wanted to do anyway so that was about the only good thing there =) I smile here but will never be happy about what Google did here and don't think you will be either.

Solved!

Upvotes: 9

Related Questions