Google Drive API is not working after Proguard obfucation

怎甘沉沦 提交于 2020-01-01 20:48:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!