简体   繁体   中英

Google+ sign-in results in a “unknown error” - Google Play Game Services

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?

在此输入图像描述

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.

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 .

If you are running your app in debug mode, ie 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM