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?
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.
Related
Recently I've been working on integrating a GRPC API in a size sensitive android app. The API only had a couple of Unary calls. I noticed that the resulting APK had io.grpc (613KB) & io.opencensus (178.9KB) which was further reduced to 387.2KB and 39.4KB respectively using Proguard. I noticed that Proguard was able to remove many streaming call related classes/methods from the APK. However, I noticed that the app already had com.google.protobuf package, which I suspect is from something like Firebase SDK.
If Firebase SDK imported com.google.protobuf, why didn't it need io.grpc for transport? Does it use something else?
The protobuf protocol is used by some Firebase SDKs as part of their internal communications. The first one that comes to mind is Firebase Analytics, but there are others too.
The Cloud Firestore SDK in Firebase uses grpc as part of its transport protocol. If you're not using Cloud Firestore then the grpc library will not be included as far as I know.
To ensure that unused methods are removed, be sure to use ProGuard as part of your release build.
I was running into problems with how many methods I have in my project, and have finally fixed it.
However, I noticed that the Localytics documentation says to include the dependency com.google.android.gms:play-services-ads. It is never used anywhere in my project, and I can't find anything on their website as to why its a required dependency.
My app runs perfectly fine without it as far as I can tell, but I have only tried building the project as a debug build.
play-services-ads used to be the only way of gaining access to the Advertising ID and it seems that functionality was added back in version 2.60 as per the SDK Changelog. The only mention of it appears to be in the testing attribution section, although that doesn't mean it is only used for attribution.
As of Google Play services 9.0, it has been moved to the play-services-basement dependency, which is much smaller. You should be able to use that dependency in place of play-services-ads without issue.
My project is open source and implements features from Google Play Services such as location. I'm having trouble in that when I upload my project to GitHub for instance, when the project is downloaded onto another user's machine to be worked on, all the references to Google Play Services become 'cannot be resolved' errors. Even uploading and redownloading the source on my own machine which has the Google Play Services SDK results in errors. Apparently the source code needs to be manually linked to the Google Play Services SDK each time it is imported to a different machine.
Is there a way to include the Google Play Services code in the source without requiring each user that downloads it to manually set up the Google Play Services SDK?
https://github.com/owncloud/android/blob/master/SETUP.md
This is a setup guide of another app. in it you can see setup_env scripts. You can have a solution like this and write a setup guide like this one for users who want to build.
Before you read this, NOTICE:
I have done my research and have read other questions like the following
The Google Play services resources were not found. Check your project configuration to ensure that the resources are included
and more,
the error I get is:
The Google Play services resources were not found. Check your project configuration to ensure that the resources are included
I'm Using Eclipse
What they offered in other questions
updating all the packages & software
adding the library to the Java Build Path (I am using Eclipse)
using the Google API instead of the Android one (in project properties -> android)
none of these solutions seems to help, and I'm hoping maybe someone will have a better solution here
What Service I am using
I'm trying to use Google's GCM Service
so...anyone?
It happened for me when Location Service is not able to get the current location by any means - and setMyLocationEnabled(true) is called.
Have you placed the google library file in the location of your project file? Have you checked in the project properties that google play services library is included or not? Is it shows red cross before the googl play services library in properties dialog?
My app works pretty good without ProGuard but when using it, I always get
403 UsageLimits, Access Not Configured
errors from the Google Drive API.
I am using this ProGuard configuration. There are no Exceptions thrown - everything seems to work fine - just the requests fail.
Any ideas?
I just found the reason why it failed.
Not proguard is the issue. I genereated a SHA-Hash and entered it in the Google API Console for my app. The release version is signed with another keystore and I had to generate another SHA-Hash for this version.