Facebook 正在取消 onCancel

Facebook is firing onCancel

我正在阅读线程:Android Facebook 4.0 SDK How to get Email, Date of Birth and gender of User 我正在使用完全相同的代码来调用 facebook 登录,但是,总是触发方法 onCancel,我做错了什么?

public class LoginActivity extends AppCompatActivity {

    CoordinatorLayout BackgroundImage;
    int[] images = new int[] {R.drawable.bg01, R.drawable.bg02, R.drawable.bg03};
    Button BtnIniciar;
    TextView BtnRecuperar;
    EditText txtCorreo;
    EditText txtContrasena;
    String androidId;
    TextView btnRegistrar;
    LoginButton loginButton;
    CallbackManager callbackManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        FacebookSdk.sdkInitialize(getApplicationContext());
        setContentView(R.layout.activity_login);


        BackgroundImage = (CoordinatorLayout)findViewById(R.id.background);
        int imageId = (int)(Math.random() * images.length);
        BackgroundImage.setBackgroundResource(images[imageId]);

        BtnIniciar = (Button) findViewById(R.id.Iniciar);
        BtnRecuperar = (TextView) findViewById(R.id.btnRecuperar);

        txtCorreo = (EditText) findViewById(R.id.txtCorreo);
        txtContrasena = (EditText) findViewById(R.id.txtContrasena);
        btnRegistrar = (TextView) findViewById(R.id.btnRegistrar );

        androidId = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);

        Boolean isLogged = new HttpGetPost().IsLogged(androidId);

        if(isLogged){
            Intent intent = new Intent( LoginActivity.this, MainActivity.class);
            startActivity(intent);
        }

        BtnIniciar.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                boolean result = new HttpGetPost().Login(txtCorreo.getText().toString(), txtContrasena.getText().toString(), 2, androidId);
                if (result) {
                    Intent intent = new Intent(v.getContext(), MainActivity.class);
                    startActivity(intent);
                } else {
                    Toast.makeText(v.getContext(), "El usuario/contraseña no es válido.", Toast.LENGTH_LONG).show();
                }
            }
        });

        BtnRecuperar.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(v.getContext(), RecuperarContrasena.class);
                startActivity(intent);
            }
        });

        btnRegistrar.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(v.getContext(), RegistroActivity.class);
                startActivity(intent);
            }
        });

        //MultiDex.install(this);

        loginButton = (LoginButton) findViewById(R.id.login_button);

        loginButton.setReadPermissions(Arrays.asList(
                "public_profile", "email", "user_birthday", "user_friends"));

        callbackManager = CallbackManager.Factory.create();

        // Callback registration
        loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
            @Override
            public void onSuccess(LoginResult loginResult) {
                // App code
                GraphRequest request = GraphRequest.newMeRequest(
                        loginResult.getAccessToken(),
                        new GraphRequest.GraphJSONObjectCallback() {
                            @Override
                            public void onCompleted(JSONObject object, GraphResponse response) {
                                Log.v("LoginActivity", response.toString());

                                // Application code
                               // String email = object.getString("email");
                               // String birthday = object.getString("birthday"); // 01/31/1980 format
                            }
                        });
                Bundle parameters = new Bundle();
                parameters.putString("fields", "name,email");
                request.setParameters(parameters);
                request.executeAsync();


            }

            @Override
            public void onCancel() {
                // App code
                Log.v("LoginActivity", "cancel");
            }

            @Override
            public void onError(FacebookException exception) {
                // App code
                Log.v("LoginActivity", exception.getCause().toString());
            }
        });
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        callbackManager.onActivityResult(requestCode, resultCode, data);
    }

    @Override
    public void onBackPressed() {
        return;
    }

我发现了错误,错误是: 我将 key_hash 添加到 fb_login_protocol_scheme 中,应该是:fb12322222 因为我的 APP ID12322222.