3

I am trying to implement the Google Play Game Services and on the Main Menu of my app I have a Google+ sign-in button. When the user tries to login they get all the way through the login process (5+ screens) they get to the point where I think it is finalizing the login and then the below error pops up.

dsf

This is happening on my testers phones and I can reproduce it on my AVD emulator. The error obviously is kind of vague. I have tried all the solutions in link here to no success.

Can someone help me out? Not sure what code you need but I have posted relevant snippets of my MainMenu class below.

MainMenu.class

public class MainMenu extends BaseGameActivity {

    DatabaseHelper dh;

    ImageView image;
    Button startBtn, highscoresBtn, aboutBtn, comingsoonBtn, biblestudyBtn, signOut;

    SignInButton sign_in_button;
    TextView title, subtitle;

    public static final String notice = "notice";

    GamesClient client;

    Context c;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mainmenu);

        client = getGamesClient();
        client.connect();

        c = this;

        sign_in_button = (SignInButton)findViewById(R.id.sign_in_button);
        signOut = (Button)findViewById(R.id.sign_out_button); 
        startBtn = (Button)findViewById(R.id.startBtn);
        highscoresBtn = (Button)findViewById(R.id.highscoresBtn);
        aboutBtn = (Button)findViewById(R.id.aboutBtn);
        comingsoonBtn = (Button)findViewById(R.id.comingsoonBtn);
        biblestudyBtn = (Button)findViewById(R.id.biblestudyBtn);
        title = (TextView)findViewById(R.id.title);
        subtitle = (TextView)findViewById(R.id.subtitle);

        startBtn.setText(c.getResources().getString(R.string.startBtn));
        highscoresBtn.setText(c.getResources().getString(R.string.highscoresBtn));
        aboutBtn.setText(c.getResources().getString(R.string.aboutBtn));
        comingsoonBtn.setText(c.getResources().getString(R.string.comingsoonBtn));
        biblestudyBtn.setText(c.getResources().getString(R.string.biblestudyBtn));
        title.setText(c.getResources().getString(R.string.title));
        subtitle.setText(c.getResources().getString(R.string.subtitle));
        //sign_in_button.setText(c.getResources().getString(R.string.signin));
        signOut.setText(c.getResources().getString(R.string.signout));

        sign_in_button.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                // start the asynchronous sign-in flow
                beginUserInitiatedSignIn();
            }
        });

        signOut.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                // sign-out
                signOut();

                // show sign-in button, hide the sign-out button
                findViewById(R.id.sign_in_button).setVisibility(View.VISIBLE);
                findViewById(R.id.sign_out_button).setVisibility(View.GONE);
            }
        });
    }

    public void onSignInSucceeded() {
        // show sign-out button, hide the sign-in button
        findViewById(R.id.sign_in_button).setVisibility(View.GONE);
        findViewById(R.id.sign_out_button).setVisibility(View.VISIBLE);

        final Dialog dialog = new Dialog(c);
        dialog.setContentView(R.layout.importlayout);
        dialog.setTitle(R.string.importtitle);

        TextView question = (TextView)dialog.findViewById(R.id.question);       
        Button save = (Button)dialog.findViewById(R.id.save);
        Button scratch = (Button)dialog.findViewById(R.id.scratch);

        question.setText(c.getResources().getString(R.string.importquestion));
        save.setText(c.getResources().getString(R.string.savebtn));
        scratch.setText(c.getResources().getString(R.string.scratchbtn));

        save.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {

                //...
            }
        });

        scratch.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                dh.deleteAll();
                for(int i = 0; i < 15; i++) {
                    dh.insert(0, 0, "-");
                }
                dialog.dismiss();
                dh.closeDB();
            }
        });

        dialog.show();
    }

    public void onSignInFailed() {
        // sign in has failed. So show the user the sign-in button.
        findViewById(R.id.sign_in_button).setVisibility(View.VISIBLE);
        findViewById(R.id.sign_out_button).setVisibility(View.GONE);

        // (add any code if needed)
    }
}

EDIT

What I've tried:

  • Making sure the SHA1/Certificate Fingerprint is correct

EDIT #2

Just noticed something. Do I need t click "Publish your game" in order for all of this to start working?

Also, do I need to export and upload the APK as a draft into the Dev Console first?

enter image description here

Community
  • 1
  • 1
Matt
  • 3,882
  • 14
  • 46
  • 89
  • can you post the output of "adb logcat" ? – cbrulak Jun 10 '13 at 21:08
  • @cbrulak - When I click OK on the window in the screenshot the window just goes away and brings me back to my app. No errors are displayed in the LogCat. – Matt Jun 11 '13 at 00:10

4 Answers4

1

I think the Certificate Fingerprint auto-selected by Google Play is not correct. Try deleting your app client ID on Google APIs Console, unlinked your app, then relinked it with the proper Certificate Fingerprint. The right Fingerprint is displayed when exporting your app in Eclipse.

GioLaq
  • 2,489
  • 21
  • 26
  • I think you were right that Google Play was auto-selecting the incorrect Certificate Fingerprint. I went and deleted my app and client ID from Google APIs Console and unlinked my app. I redid everything and set it back up and it tried to auto-select the incorrect SHA1/Certificate Fingerprint. I entered int he correct one. So this was probably an issue that I would have found later but unfortunately I am still getting the same error after cleaning, rebuilding and rebooting the AVD. +1 for helping with that part but I still am getting the same error. – Matt Jun 11 '13 at 00:50
  • 1
    Google Play does *not* auto-select a certificate fingerprint. What appears in the window is just an example. – Bruno Oliveira Jun 12 '13 at 20:12
  • I would have removed the example SHA1. It only creates confusion imho. – Angelo Tricarico Jun 13 '13 at 09:18
  • 7 months later, I have retried to implement the login and everything worked the first time. I noticed several differences in the tutorials that made them more clear this time around (for example, explicitly labeling the SHA1 as an example in this case). – Matt Dec 27 '13 at 17:20
1

Google Play does not auto-select a fingerprint. What you see in that window is an example fingerprint designed to communicate what a fingerprint looks like. You should find out your own fingerprint by using the keytool command, like this:

keytool -exportcert -alias your-key-name -keystore /path/to/your/keystore/file -list -v

If your key is a debug key, then your-key-name will typically be androiddebugkey.

Bruno Oliveira
  • 5,056
  • 18
  • 24
  • Ok, good to know @BrunoOliveira! You seem to be part of the Android/Google team. Any ideas on the "Unknown error"? – Matt Jun 12 '13 at 23:44
  • I was thinking that Google Play was (wrongly) retrieving the fingerprint from the uploaded APK. Nice to know. – Hartok Jun 14 '13 at 12:27
0

If you are running your app in debug mode, i.e. signed by the debug certificate not your publish certificate, make sure that you have also configured the app with this SHA1 (you can add a 2nd linked app for the same package name).

Also make sure your testers are on the testers list.

Run "adb logcat" that will really help.

smiller
  • 54
  • 2
0

This seemed obvious to me after I realized what was wrong with the program, but make sure the account you are signing to is either the account listed as a developer, or an account listed as a Tester under Testing. When testing multiplayer, the other player's google plus accounts must be listed as testers as well.

Testing is listed in the 6 choices when you select a game from the Google Play Game Services in the Developer Console.

Andrew T.
  • 4,598
  • 4
  • 35
  • 54