问题
I am using
compile 'com.google.android.gms:play-services-auth:10.0.1'
compile 'com.google.android.gms:play-services-drive:10.0.1'
to implement Google Drive in my Android app. The app is working well until i obfuscate the application with Proguard. Once the application is obfuscated, while i try to enable Google Drive Backup option, the app pop-ups the account selection dialog and doesn't proceed after that.
In the debug version of the app, while i try to enable Google Drive Backup option, the app pop-ups the account selection and then proceed to Google Drive Permission dialog to access the drive files.
I have read that Google added the Proguard rule for the Google Play Services and wonder what could be the issue in my case. I have also tried the Proguard rules suggested in the following StackOverFlow threads
Google Drive API doesn't play well with ProGuard (NPE)
Release apk not working after enabling proguard, not able to debug too
How to fix Proguard issue with Google Drive REST API
But, the provided solutions didn't work for me. Is there any new rules to be added for the latest Google Drive API to work?
回答1:
As suggested here, you can check what gets taken away by looking at the ProGuard output files. Also based from this blog, it was definitely a Proguard problem. It was also noticed that one of the debug statements indicated that the Files object had some obfuscated fields that were probably causing a problem. A quick look at the class file showed that this class had some annotations and we’d seen references in Proguard to keep annotations.
You may also check on this thread if it helps.
来源:https://stackoverflow.com/questions/41714912/google-drive-api-is-not-working-after-proguard-obfucation