googleworkspace / android-samples

Android samples for Google Workspace APIs
Apache License 2.0
635 stars 410 forks source link

Error after updating to new Gradle version #120

Open titovnick opened 5 years ago

titovnick commented 5 years ago

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"
}
]
sqrrrl commented 5 years ago

Which particular sample was this for?

titovnick commented 5 years ago

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

HeinousGames commented 4 years ago

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.

HeinousGames commented 4 years ago

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.

MarsVard commented 3 years ago

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

HeinousGames commented 3 years ago

@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.