Closed geoseong closed 2 years ago
maybe its lack of some library, check yours mainTemplate.gradle? hope helping you~
@zhangjianshuai
maybe its lack of some library, check yours mainTemplate.gradle? hope helping you~
thank you for replying this, but I don't check Custom Main Gardle Template
in Project Settings, should I check this option first?
@zhangjianshuai
maybe its lack of some library, check yours mainTemplate.gradle? hope helping you~
thank you for replying this, but I don't check
Custom Main Gardle Template
in Project Settings, should I check this option first?
check the box "Custom Proguard File" and paste this into the proguard file:
-keep class com.google.android.gms.games.Games. { *; } -keep class com.google.android.gms.games.multiplayer.* { ; } -keep class com.google.android.gms.games.leaderboard. { *; } -keep class com.google.android.gms.games.snapshot. { *; } -keep class com.google.android.gms.games.achievement.* { ; } -keep class com.google.android.gms.games.event. { *; } -keep class com.google.android.gms.games.stats. { *; } -keep class com.google.android.gms.games.video. { ; } -keep class com.google.android.gms.games. { ; } -keep class com.google.android.gms.common.api.ResultCallback { ; } -keep class com.google.android.gms.signin. { *; } -keep class com.google.android.gms.dynamic. { *; } -keep class com.google.android.gms.dynamite. { *; } -keep class com.google.android.gms.tasks.* { ; } -keep class com.google.android.gms.security. { *; } -keep class com.google.android.gms.base. { *; } -keep class com.google.android.gms.actions.* { ; } -keep class com.google.games.bridge. { ; } -keep class com.google.android.gms.common.ConnectionResult { ; } -keep class com.google.android.gms.common.GooglePlayServicesUtil { *; } -keep class com.google.android.gms.common.api. { ; } -keep class com.google.android.gms.common.data.DataBufferUtils { ; } -keep class com.google.android.gms.games.quest. { *; } -keep class com.google.android.gms.nearby.* { ; } -keep class com.unity.androidnotifications.* { ; }
proguard-user.txt will appear after you check the box in the following directory:
@MarkMa-LS I tried to follow your suggestion and paste that to the Assets/Plugins/Android/proguard-user.txt
and I got error when I try to build.
java.io.IOException: proguard.ParseException: Expecting java type before ';' in line 1 of file '{project_path}/Temp/gradleOut/unityLibrary/build/intermediates/consumer_proguard_dir/release/lib1/proguard.txt' See the Console for details.
so I changed some context to put *
in { ; }
area in Assets/Plugins/Android/proguard-user.txt
.
-keep class com.google.android.gms.games.Games.** { *; }
-keep class com.google.android.gms.games.multiplayer.* { *; }
-keep class com.google.android.gms.games.leaderboard.* { *; }
-keep class com.google.android.gms.games.snapshot.* { *; }
-keep class com.google.android.gms.games.achievement.* { *; }
-keep class com.google.android.gms.games.event.* { *; }
-keep class com.google.android.gms.games.stats.* { *; }
-keep class com.google.android.gms.games.video.* { *; }
-keep class com.google.android.gms.games. { *; }
-keep class com.google.android.gms.common.api.ResultCallback { *; }
-keep class com.google.android.gms.signin. { *; }
-keep class com.google.android.gms.dynamic.* { *; }
-keep class com.google.android.gms.dynamite.* { *; }
-keep class com.google.android.gms.tasks.* { *; }
-keep class com.google.android.gms.security.* { *; }
-keep class com.google.android.gms.base.* { *; }
-keep class com.google.android.gms.actions.* { *; }
-keep class com.google.games.bridge.* { *; }
-keep class com.google.android.gms.common.ConnectionResult { *; }
-keep class com.google.android.gms.common.GooglePlayServicesUtil { *; }
-keep class com.google.android.gms.common.api. { *; }
-keep class com.google.android.gms.common.data.DataBufferUtils { *; }
-keep class com.google.android.gms.games.quest. { *; }
-keep class com.google.android.gms.nearby. { *; }
-keep class com.unity.androidnotifications.* { *; }
and apk had generated (build success) but still no luck.
The logs in logcat seems to be changed.
this log generated when I click the button and trigger OnSignInToGooglePlayGamesService()
event.
AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.games.Games
java.lang.ClassNotFoundException: com.google.android.gms.games.Games
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:246)
at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
Caused by: java.lang.ClassNotFoundException: com.google.android.gms.games.Games
... 8 more
at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) [0x00000] in <000000000000
I figured out the right contents of Assets/Plugins/Android/proguard-user.txt
and finally it worked!
the only differences between @MarkMa-LS 's suggestion and this repo's proguard are like this below.
anyways thank you for the suggestion, @MarkMa-LS !
-keep class com.google.android.gms.games.Games.** { *; }
-keep class com.google.android.gms.games.multiplayer.** { *; }
-keep class com.unity.androidnotifications.* { *; }
after build success and run in my Android Device and push button to signin, it worked!
logcat's log is like this
Starting Auth with token client.
GooglePlayGames.Android.AndroidClient:Authenticate(Boolean, Action`1)
UnityEngine.Events.UnityAction:Invoke()
UnityEngine.Events.UnityEvent:Invoke()
UnityEngine.EventSystems.EventFunction`1:Invoke(T1, BaseEventData)
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchEvents()
UnityEngine.EventSystems.StandaloneInputModule:Process()
...
Returning an error code.
GooglePlayGames.Android.<>c__DisplayClass18_0:<Authenticate>b__0(Int32)
System.Action`1:Invoke(T)
System.Action`1:Invoke(T)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
UnityEngine.AndroidJavaProxy:Invoke(String, Object[])
UnityEngine._AndroidJNIHelper:InvokeJavaProxyMethod(AndroidJavaProxy, IntPtr, IntPtr)
Starting Auth with token client.
GooglePlayGames.Android.AndroidClient:Authenticate(Boolean, Action`1)
System.Action`1:Invoke(T)
System.Action:Invoke()
GooglePlayGames.OurUtils.PlayGamesHelperObject:Update()
Hi.
I started to use this plugin from this Monday, and I'm struggling with this problem for 3 days.
I first tried to follow this youtube guide
after following this, it fails.
so I fixed that error above
Custom Proguard File
in Player settings and copy & paste refer to thisproguard.txt
file to my localproguard.txt
.after when I tried to signin, the status is always
Canceled
. so I tried to checkCustom Main Manifest
in Player settings, it fails.my code is like this
and seeing the logcat, I found some point. that always make this error message like
here is the full logcat log file when I tried to signin.
I think I've checked the exact tester email address and client ID. and I released internal testing only. is that a problem?
I am using Unity 2020.3.1f1 btw.
Please someone help this issue to be fixed :( 🥲