googleworkspace/android-samples

Error after updating to new Gradle version

Opened this issue · 6 comments

Hi!

After updating Android Gradle plugin to 3.5.0 and Gradle to 5.4.1 I am getting always an error from Drive API. Whenever I downgrade to old gradle, everything works like a charm. Is there any ideas why can it happen and what are the steps to resolve this issue? Thanks!

Response:

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

Which particular sample was this for?

Hi @sqrrrl, thanks for your answer. Getting this for Deprecation sample.

I am also getting this error, but can't downgrade my gradle plugin version to test if it will fix the issue. Is there another workaround available? I have also tried getting an access token from GoogleAuthUtil and setting it in the DriveServiceHelper calls with the setOauthToken method, but that also doesn't work.

Turns out the solution is to add this line to the proguard file:
-keepclassmembers class * { @com.google.api.client.util.Key <fields>; }

I would recommend the sample project have its gradle plugin version updated, and a proguard file added to it to prevent users from reaching this issue.

@HeinousGames that doesn't fix anything, I started getting the error as well and I'm not even using proguard

@HeinousGames that doesn't fix anything, I started getting the error as well and I'm not even using proguard

Please refer to this doc: https://developer.android.com/studio/build/shrink-code
It mentions that gradle plugin 3.4.0 turns Proguard into R8, and that when building release R8 is on by default (ie using gradle 3.4.0+ turns Proguard on). I believe to resolve the issue you must either turn R8/Proguard fully off, or add a Proguard file with the rule I mentioned previously.