简体   繁体   English

无法使用Release Apk登录到Google和Facebook

[英]Can not sign in with Google and Facebook with Release Apk

I am working with android application which contain sign in with google and sign in with Facebook , in the debugging mode both worked fine but after making release Apk and upload it to play store , both of Facebook and Google does not work . 我正在使用包含用google登录和用Facebook登录的android应用程序,在调试模式下都可以正常工作,但是在发布Apk并将其上传到Play商店后,Facebook和Google都无法使用。 I did the Following steps : 1-i generate my new certificate fingerprint for release Apk and replace the old one in Facebook developer and making new Google App with new certificate fingerprint but also that did not work for me . 我执行了以下步骤:1-i为发行的Apk生成了新的证书指纹,并替换了Facebook开发人员中的旧证书指纹,并使用新的证书指纹制作了新的Google App,但这也不适用于我。 this is Facebook login part 这是Facebook登录部分

 //facebook part
    callbackManager = CallbackManager.Factory.create();
    loginButton= (LoginButton)findViewById(R.id.login_button);
    loginButton.setReadPermissions(Arrays.asList("email", "user_photos", "public_profile"));
    loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
        @Override
        public void onSuccess(LoginResult loginResult) {
            Bundle parameters = new Bundle();
            parameters.putString("fields", "id, first_name, last_name, email,gender, birthday, location"); // Parámetros que pedimos a facebook
            //  Toast.makeText(getApplicationContext(),""+loginResult.getAccessToken(),Toast.LENGTH_SHORT).show();
            final String accessToken = loginResult.getAccessToken().getToken();
            GraphRequest request = GraphRequest.newMeRequest(loginResult.getAccessToken(), new GraphRequest.GraphJSONObjectCallback() {
                @Override
                public void onCompleted(JSONObject object, GraphResponse response) {
                    Log.i("LoginActivity", response.toString());
                    // Get facebook data from login
                    try {
                        String FaceEmail= (String)object.get("email");
                        object.get("gender");
                        if(accessToken!=null)
                        {
                            if(isNetworkAvailable()) {
                                checkEmail(accessToken, "f");
                            }

                        }
                        else
                        {
                            Toast.makeText(MainActivity.this,"Please try another method to login ",Toast.LENGTH_SHORT).show();
                        }

                    } catch (JSONException e) {
                        e.printStackTrace();
                    }

but always i got an exception "Invalid hash key" 但总是有一个异常“无效的哈希键”

and this is Google login part 这是Google登录部分

public void signIn ()
{   Intent intent =Auth.GoogleSignInApi.getSignInIntent(googleApiClient);}
  public void handleResult (GoogleSignInResult result)
{
    if (result.isSuccess()) {
        GoogleSignInAccount account = result.getSignInAccount();
        String email = account.getEmail();
        if(email!=null) {
            upateUI(true,email);
        }
        else
        {
            upateUI(false,"");
        }
    }
    else
        upateUI(false,"");

}

Note that i made my google app and Upload my Signed Apk from different Accounts. 请注意,我制作了Google应用,并从其他帐户上传了我的签名Apk。 does this make any problem? 这有什么问题吗? So what can i do? 那我该怎么办?

这对我有用:我进入游戏机,发现了两个证书指纹,第一个使Google与发行版Apk一起使用,第二个是我的密钥库的证书指纹

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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