• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by David_29 · Jul 04, 2016 at 03:45 AM · androidunity 5google play gamesauthenticationleaderboards

Showing Google Play Game Leaderboard UI not working at all

Trying to figure out what went wrong with t$$anonymous$$s GPG plugin. I followed the instructions and understand the document in order to test run the login and show leaderboard UI via t$$anonymous$$s one. I did make the play games ac$$anonymous$$evements + leaderboard via Google Play developer account, do the setup, copy-paste source, and done. Testing the ads via adding Admob Unity package and GPG Unity package and it worked perfectly. I even update some plugins for Android (etc. .aar files, firebase-common, manifest) in order to maximize compatibility and efficiency so that I could build APK without any issues that interfering the build-up.

However, there is one issue: after I logged in and trying to tap the "show leaderboard UI" button along with the button event that asks if the user is authenticated and it will allow you to record your latest $$anonymous$$ghscore by updating it before showing the leaderboard UI. Here's how the code works:

First, at the Start() callback...

 PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
         .Build();

     PlayGamesPlatform.InitializeInstance(config);
     PlayGamesPlatform.DebugLogEnabled = true;
     PlayGamesPlatform.Activate();

Next, here's the login/logout process...

 public void LogInAccount() {
 // Show dialog.
 y = 0;
 dialogPanel.SetActive (true);
 dialogBackground.SetActive (true);

 // You can logout if you're logged in.
 if(Social.localUser.authenticated) {

     ((PlayGamesPlatform)Social.Active).SignOut ();

     y = 0;
     message.text = "Your account have been logged out.";
     logButtonLabel.text = "Log-in via Google";
     button.SetActive (true);
     confirmSound.Play();

     return;

 } 

 // Check for status.
 if (CheckNetwork.checkOnlineStatus ()) {
 
     Social.localUser.Authenticate ((bool success) => {

         if (success) {

             // LOG IN SUCCESS! (Check if the email is identified or not.)
             if((((PlayGamesLocalUser)Social.localUser).Email != null) || (((PlayGamesLocalUser)Social.localUser).Email != "")) {

                 y = 0;
                 message.text = "Login complete. However, email is not verified or unknown.";
                 logButtonLabel.text = "Log-out";
                 button.SetActive (true);
                 errorSound.Play();

             } else {

                 y = 0;
                 message.text = "Login complete!\nYour email:" + ((PlayGamesLocalUser)Social.localUser).Email;
                 logButtonLabel.text = "Log-out";
                 button.SetActive (true);
                 confirmSound.Play();

             }

         } else if (!success) {

             // LOG IN FAILED.
             if((((PlayGamesLocalUser)Social.localUser).Email != null) || (((PlayGamesLocalUser)Social.localUser).Email != "")) {

                 message.text = "Login failed. Please try again later.\nYour email: ? ? ?";

             } else {

                 message.text = "Login failed. Please try again later.\nYour email: " + ((PlayGamesLocalUser)Social.localUser).Email;

             }

             y = 0;
             button.SetActive (true);
             logButtonLabel.text = "Log-in via Google";
             errorSound.Play();

         }

     });

 } else {
 
     message.text = "Connection is lost. Please enable online.";
     button.SetActive (true);

 }

}

And then, the show leaderboard callback/button event.

     public void OpenLeaderboard() {
 
         // Show dialog.
         y = 0;
         dialogPanel.SetActive (true);
         dialogBackground.SetActive (true);
 
         // Check for status.
         if (Social.localUser.authenticated && CheckNetwork.checkOnlineStatus ()) {
 
             // Updating your $$anonymous$$ghscore...
             Social.ReportScore ((long)Score.GetScore (), 
                 Ac$$anonymous$$evementReference.leaderboard_best_intergalactic_chasers_top_score,
                 (bool success) => {
 
                     if(success) {
 
                         // LEADERBOARD APPEARED!
                         dialogPanel.SetActive (false);
                         dialogBackground.SetActive (false);
                         confirmSound.Play();
                         Social.ShowLeaderboardUI();
 //                        ((PlayGamesPlatform)Social.Active).ShowLeaderboardUI(Ac$$anonymous$$evementReference.leaderboard_best_intergalactic_chasers_top_score);
 
                     } else {
 
                         y = 0;
                         message.text = "Load failed. Please try again later.";
                         button.SetActive (true);
                         errorSound.Play();
 
                     }
 
                 });
 
         } else if (!Social.localUser.authenticated) {
 
             y = 0;
             confirmSound.Play();
             button.SetActive (true);
         
             if (!CheckNetwork.checkOnlineStatus ()) {
 
                 message.text = "Connection not available at a moment.";
 
             } else if (CheckNetwork.checkOnlineStatus ()) {
 
                 message.text = "You must login first in order to see the leaderboard.";
 
             }
 
         }
 
     }

At my first attempt, I do login (it shows the welcome sign sometimes) and tap the leaderboard button but not$$anonymous$$ng happens after 2 minutes. Second attempt, I do login-logout-login method and the GPG prompted me to select the Email address and the welcome username sign appeared on top. However, still...when I tapped the show leaderboard UI button and not$$anonymous$$ng happens after 3 minutes. I used t$$anonymous$$s reference to gain more ideas on effective showing the leaderboardc UI and checked for the code sample. Final attempt, and I assumed that leaderboard UI won't show up until I publish the Game Services I've created (it was set for testing mode before) and see if the leaderboard UI is working or not. Then after a day or two, used the same method from first second attempt and still got no luck.

The question is: how come the leaderboard UI still won't show-up during test mode and even after published the game services via Google play Services developer section? The same t$$anonymous$$ng happen in displaying in Ac$$anonymous$$evements UI. What was the cause that preventing the leaderboard UI from showing up even if I did it correctly on the setup? I doubt it's the internet connection issues or wifi signal. The issues probably is the long load on a very simple game services I've made. I only created only two leaderboards ($$anonymous$$ghscore and no. of s$$anonymous$$ps destroyed) and five ac$$anonymous$$evements on reac$$anonymous$$ng certain score and no. of s$$anonymous$$ps destroyed. Please help.

Also, aside from showing leaderboard UI issues, there is also an error that leaves the string value (actually, I'm retrieving with the email address selected) null or empty even if successfully logged in via Google account follow-up by the welcome username sign at the top of the screen.

UPDATE (As of 2:46 PM via P$$anonymous$$lippines, 7/5/2016): After I checked the bugs and offer some solution from S. Tarik Cetin, I checked on logcat about login. At first, I thought it's successful login. Then, I noticed t$$anonymous$$s:

 W/Unity   (32099): *** [Play Games Plugin DLL] 07/05/16 14:33:54 -07:00 ERROR: E
 xception launc$$anonymous$$ng token request: java.lang.ClassNotFoundException: com.google.g
 ames.bridge.TokenFragment
 W/Unity   (32099):
 W/Unity   (32099): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
 bugBindings.gen.cpp Line: 37)
 W/Unity   (32099):
 W/Unity   (32099): *** [Play Games Plugin DLL] 07/05/16 14:33:54 -07:00 ERROR: U
 nityEngine.AndroidJavaException: java.lang.ClassNotFoundException: com.google.ga
 mes.bridge.TokenFragment
 W/Unity   (32099): java.lang.ClassNotFoundException: com.google.games.bridge.Tok
 enFragment
 W/Unity   (32099):      at java.lang.Class.classForName(Native Method)
 W/Unity   (32099):      at java.lang.Class.forName(Class.java:217)
 W/Unity   (32099):      at java.lang.Class.forName(Class.java:172)
 W/Unity   (32099):      at com.unity3d.player.UnityPlayer.nativeRender(Native Me
 thod)
 W/Unity   (32099):      at com.unity3d.player.UnityPlayer.a(Unknown Source)
 W/Unity   (32099):      at com.unity3d.player.UnityPlayer$b.run(Unknown Source)
 W/Unity   (32099): Caused by: java.lang.NoClassDefFoundError: com/google/games/b
 ridge/TokenFragment
 W/Unity   (32099):      ... 6 more
 W/Unity   (32099): Caused by: java.lang.ClassNotFoundException: com.google.games
 .bridge.TokenFragment
 W/Unity   (32099):      at dalvik.system.BaseDexClassLoader.findClass(BaseDexCla
 ssLoader.java:61)
 W/Unity   (32099):      at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
 
 W/Unity   (32099):      at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
 
 W/Unity   (32099):      ... 6 more
 W/Unity   (32099):   at UnityEngine.AndroidJNISafe.CheckException () [0x00000] i
 n <filename unknown>:0
 W/Unity   (32099):   at UnityEn

Also, I encountered the status form my logcat when I did sign-in and out once.

 W/Unity   (32099):   at UnityEn
 I/Unity   (32099):  [Play Games Plugin DLL] 07/05/16 14:38:07 -07:00 DEBUG: Star
 ting Auth Transition. Op: SIGN_OUT status: ERROR_NOT_AUTHORIZED
 I/Unity   (32099):
 I/Unity   (32099): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
 bugBindings.gen.cpp Line: 37)
 I/Unity   (32099):

Finally, here's the issue found during attempt on opening leaderboard UI directly.

 W/Unity   (32099): *** [Play Games Plugin DLL] 07/05/16 14:40:31 -07:00 ERROR: U
 nityEngine.AndroidJavaException: java.lang.ClassNotFoundException: com.google.ga
 mes.bridge.NativeBridgeActivity
 W/Unity   (32099): java.lang.ClassNotFoundException: com.google.games.bridge.Nat
 iveBridgeActivity
 W/Unity   (32099):      at java.lang.Class.classForName(Native Method)
 W/Unity   (32099):      at java.lang.Class.forName(Class.java:217)
 W/Unity   (32099):      at java.lang.Class.forName(Class.java:172)
 W/Unity   (32099):      at com.unity3d.player.UnityPlayer.nativeRender(Native Me
 thod)
 W/Unity   (32099):      at com.unity3d.player.UnityPlayer.a(Unknown Source)
 W/Unity   (32099):      at com.unity3d.player.UnityPlayer$b.run(Unknown Source)
 W/Unity   (32099): Caused by: java.lang.NoClassDefFoundError: com/google/games/b
 ridge/NativeBridgeActivity
 W/Unity   (32099):      ... 6 more
 W/Unity   (32099): Caused by: java.lang.ClassNotFoundException: com.google.games
 .bridge.NativeBridgeActivity
 W/Unity   (32099):      at dalvik.system.BaseDexClassLoader.findClass(BaseDexCla
 ssLoader.java:61)
 W/Unity   (32099):      at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
 
 W/Unity   (32099):      at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
 
 W/Unity   (32099):      ... 6 more
 W/Unity   (32099):   at UnityEngine.AndroidJNISafe.CheckException () [0x00000] i
 n <filen

UPDATE (As of 5:29 PM via P$$anonymous$$lippines, 7/5/2016): I made a mistake about checking if the email is empty or not. I made a reading wrong. Though, email address value still has issue and it should return with identified ones in string value and leaving with a blank when it reads not empty.

 // LOG IN SUCCESS! (Check if the email is identified or not.)
 if((((PlayGamesLocalUser)Social.localUser).Email != null) || (((PlayGamesLocalUser)Social.localUser).Email != "")) {
 
     y = 0;
     message.text = "Login complete!\nYour email:" + ((PlayGamesLocalUser)Social.localUser).Email;
     logButtonLabel.text = "Log-out";
     button.SetActive (true);
     confirmSound.Play();
 
 } else {
 
     y = 0;
     message.text = "Login complete. However, email is not verified or unknown.";
     logButtonLabel.text = "Log-out";
     button.SetActive (true);
     errorSound.Play();
 
 }

Comment

People who like this

0 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

4 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by David_29 · Aug 12, 2016 at 05:12 AM

Since nobody helped me and my deadline is busted in total failure, my conclusion will provided not$$anonymous$$ng but myself. Okay, I checked and observed t$$anonymous$$s tutorial from App Guruz and make the sample one. I observed how t$$anonymous$$s game flow and use my package name to modify it. Luckily, the leaderboard UI finally showed up. I'm assumed that there are some certain particular problem or issues on plugins from Android (some library folders like firebase and .aar files) when I tried to compare mine from the sample roject form App Guruz website. Possibly compatibility issues. If you're came to make leaderboard UI's and stuff and relying on t$$anonymous$$s Unity Plugin via GIT website, stay away from t$$anonymous$$s crap. It's not worth to use it. Full of bugs, especially the Android plugins. Rely first on making your own GPG from scratch and observe the plugins and jars since I'm focused on Android only.

Comment
upariver
VonTala

People who like this

2 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by Saddamjit_Singh · Oct 12, 2017 at 07:18 AM

Add t$$anonymous$$s in your Android Manifest -

  <activity android:name="com.google.games.bridge.NativeBridgeActivity"
            android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />

Comment
KladimirVladne
logan001

People who like this

2 Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image KladimirVladne · Oct 12, 2017 at 12:40 PM 0
Share

This fixed my issue, thanks a lot!

avatar image Saddamjit_Singh KladimirVladne · Oct 12, 2017 at 12:46 PM 0
Share

Welcome.....

avatar image logan001 · Oct 20, 2017 at 04:59 AM 0
Share

Weeks after wasting so much time on this issue, I found this. Fixed the issue. Thank you so much.

avatar image mujtabaalkhamees · Mar 18, 2018 at 09:45 PM 0
Share

How do you get to the Android Manifest?

avatar image kidrobotgames · Jun 19, 2018 at 09:36 PM 0
Share

Thanks a lot, this fixed my 2 last weeks!!!!!.

avatar image biigweerakorn · Sep 21, 2018 at 03:28 PM 0
Share

still not work for me :(

avatar image

Answer by BBQBoys · Aug 14, 2018 at 07:26 PM

Upload your .apk to Google Play.

It started working like a magic after 4 days of code editing - apparently certificate-related issue. You may use beta channel, do not forget to use debug signing key, elsewise Google Play will show an error after you upload .apk.

I hope t$$anonymous$$s helps.

My app also has working leaderboard, you can check it here https://play.google.com/store/apps/details?id=com.HOTBBQ.MarshatheMarshmallow.

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by taib · Dec 03, 2019 at 08:03 PM

why make it hard just use cloudonce eazy pizzy boys

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

113 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Firebase Apple Authentication Unity For Android Platefrom?????? 0 Answers

Problem with Google Play Game Services: Invalid Classname 1 Answer

Unity 5 - Google Play NO Authentication 1 Answer

Showing Google Play Games Incremental Achievements progress popups 0 Answers

Google Play Services: Authentication Failed always 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges