Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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
0
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 this GPG plugin. I followed the instructions and understand the document in order to test run the login and show leaderboard UI via this one. I did make the play games achievements + 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 highscore 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 highscore...
             Social.ReportScore ((long)Score.GetScore (), 
                 AchievementReference.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(AchievementReference.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 nothing 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 nothing happens after 3 minutes. I used this 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 thing happen in displaying in Achievements 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 (highscore and no. of ships destroyed) and five achievements on reaching certain score and no. of ships 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 Philippines, 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 this:

 W/Unity   (32099): *** [Play Games Plugin DLL] 07/05/16 14:33:54 -07:00 ERROR: E
 xception launching 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 Philippines, 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
Add comment
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
2
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 nothing but myself. Okay, I checked and observed this tutorial from App Guruz and make the sample one. I observed how this 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 this Unity Plugin via GIT website, stay away from this 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
Add comment · 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
2

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

Add this in your Android Manifest -

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

Comment
Add comment · 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 $$anonymous$$anifest?

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
0

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 this helps.

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

Comment
Add comment · 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
0

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

why make it hard just use cloudonce eazy pizzy boys

Comment
Add comment · 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.

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

Google Play Games Services not showing achievements list and leaderboards even in Play Games app 1 Answer

Leaderboards for Android on Unity 1 Answer

Leaderboard is not displaying any score after tapping on it. I always see only one message "Unbelievable there is no score to display". 0 Answers

Unity Google Play Service Plugin Social.localUser.Authenticate(…) App Crash 1 Answer

Firebase Apple Authentication Unity For Android Platefrom?????? 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