google-signin-unity icon indicating copy to clipboard operation
google-signin-unity copied to clipboard

Proguard rules

Open ReGaSLZR opened this issue 5 years ago • 6 comments

Hi there!

Here's a screenshot from a crash scenario with a project with Google SignIn plugin on it. (The build is release-type and therefore needs Proguard rules.) Screen Shot 2020-09-25 at 14 45 08

[EDIT: The crash happens when a user successfully logs in (via Google plugin, of course)]

So far, these are the entries on my Proguard.

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

-keep class com.unity3d.player.* { *; }
-keep class com.unity3d.plugin.* { *; }
-keep class com.unity3d.ads.** { *; }
-keep class com.unity3d.services.** { *; }

-dontwarn com.google.ar.core.**
-dontwarn com.unity3d.services.**
-dontwarn com.ironsource.adapters.unityads.**

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

-keep class com.google.* {*;}
-keep class com.google.firebase.* {*;}
-keep class com.google.googlesignin.* {*;}
-keep class com.google.android.* {*;}
-keep class com.google.android.gms.auth.* {*;}

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

-keep class com.facebook.internal.* {*;}
-keep class com.facebook.unity.* {*;}

-keep class com.yasirkula.unity.* {*;}

But I feel like I'm still missing something since the logs say there's a missing method. So I come to ask, what are the exact Proguard entries for this plugin anyway? (I just guessed a bunch of them).

ReGaSLZR avatar Sep 25 '20 05:09 ReGaSLZR

I just tried

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

instead of

-keep class com.google.android.gms.auth.* {*;}

and yet, it still is crashing.

Any updates on this, guys? I just want your input on the Proguard rules for Google SignIn (Unity SDK). 😢

ReGaSLZR avatar Sep 29 '20 08:09 ReGaSLZR

I guess Google devs are busy.

I found a solution for this. Here are all the Google-related proguard rules in my project and am posting this for everyone's verification or reference:

-keep class com.google.* {*;}
-keep class com.google.impl.* {*;}
-keep class com.google.firebase.* {*;}
-keep class com.google.googlesignin.** { *; }
-keepnames class com.google.googlesignin.* { *; }
-keep class com.google.gms.** {*;}
-keep class com.google.android.gms.auth.** { *; }
-keep class com.google.android.* {*;}
-keep class com.google.unity.* {*;}

It now works on my end without crashing (on production build, proguard is turned on). In case I missed out some other important bits or there are some corrections, let me know. I just experimented on this myself.

//Not marking this ticket closed or fixed yet. Need verification from a Google dev if possible.

ReGaSLZR avatar Oct 06 '20 04:10 ReGaSLZR

Thanks man! you saved a life.

mudassar024 avatar Dec 05 '20 08:12 mudassar024

Thanks man! you saved a life.

No problem, man! Glad to have helped. You have no idea how much pressure I got from my team when this issue was around and the Google devs were not responding at all. Still are.

ReGaSLZR avatar Dec 05 '20 13:12 ReGaSLZR

I guess Google devs are busy.

I found a solution for this. Here are all the Google-related proguard rules in my project and am posting this for everyone's verification or reference:

-keep class com.google.* {*;}
-keep class com.google.impl.* {*;}
-keep class com.google.firebase.* {*;}
-keep class com.google.googlesignin.** { *; }
-keepnames class com.google.googlesignin.* { *; }
-keep class com.google.gms.** {*;}
-keep class com.google.android.gms.auth.** { *; }
-keep class com.google.android.* {*;}
-keep class com.google.unity.* {*;}

It now works on my end without crashing (on production build, proguard is turned on). In case I missed out some other important bits or there are some corrections, let me know. I just experimented on this myself.

//Not marking this ticket closed or fixed yet. Need verification from a Google dev if possible.

can we use short template for all google classes like this?

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

lcd11001 avatar Mar 04 '21 08:03 lcd11001

My proguard rules:-

-keep class com.unity.** { *;}
-keep class com.unity3d.plugin.* { *; }
-keep class com.google.** { *;}

soumyadeep-ch avatar Sep 18 '23 06:09 soumyadeep-ch