How to fix Proguard issue with Google Drive REST API

后端 未结 3 729
一向
一向 2021-01-14 15:14

I\'m using the Google Rest API v3 to connect my android app to Google Drive. When I run without Proguard (minifyEnabled=false), all is well. However, when I enable proguard

相关标签:
3条回答
  • 2021-01-14 15:55

    This one worked for me:

    -keepclassmembers class * {
      @com.google.api.client.util.Key <fields>;
    }
    

    As seen in the official google sample:

    https://github.com/google/google-api-java-client-samples/blob/master/tasks-android-sample/proguard-google-api-client.txt

    0 讨论(0)
  • 2021-01-14 15:58

    You need

    -keep class com.google.** { *;} 
    

    and

    -keep class com.fasterxml.** { *;}
    

    Also you might try to keep less from the SDK. These rules are very wide.

    Edit: Wide rules means that it probably will keep more unused classes in your project hence the apk size and method count will be bigger.

    0 讨论(0)
  • 2021-01-14 16:08

    In my case I had to put these keeps:

    -keep class br.project.pine.** { *;}
    -keep class com.google.api.services.drive.** { *;}
    

    Tip: When enabling minify in debug mode, pay attention to the LogCat. It can help you to find out the real missing package/class/attribute.

    0 讨论(0)
提交回复
热议问题