Proguard混淆后,Google Drive API无法正常工作 [英] Google Drive API is not working after Proguard obfucation

查看:118
本文介绍了Proguard混淆后,Google Drive API无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用

compile 'com.google.android.gms:play-services-auth:10.0.1'
compile 'com.google.android.gms:play-services-drive:10.0.1'

在我的Android应用中实现Google云端硬盘.在我用Proguard混淆应用程序之前,该应用程序运行良好.混淆应用程序后,尽管我尝试启用Google Drive备份选项,但该应用程序会弹出帐户选择"对话框,此后将不再继续.

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.

在该应用程序的调试版本中,当我尝试启用Google Drive备份选项时,该应用程序弹出帐户选择,然后进入Google Drive权限对话框以访问驱动器文件.

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.

我已阅读到Google为Google Play服务添加了Proguard规则,并且想知道我的情况可能是什么问题.我还尝试了以下StackOverFlow线程

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云端硬盘API在ProGuard中无法正常运行( NPE)

发布apk后无法正常工作启用proguard,也无法调试

如何使用Google Drive REST解决Proguard问题API

但是,提供的解决方案对我不起作用.是否有任何新规则要添加,以使最新的Google Drive 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?

推荐答案

此处所示,您可以检查得到了什么通过查看ProGuard 输出文件将其删除.也基于此博客 ,这绝对是Proguard的问题.还注意到,其中一个调试语句表明文件对象具有一些可能引起问题的混淆字段. 快速浏览类文件,发现该类具有一些注释,并且我们在Proguard中看到了用于保留注释的引用.

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.

这篇关于Proguard混淆后,Google Drive API无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆