Firebase身份验证:更新电子邮件

我正在使用firebase来注册用户,用户可以更新其数据,但是在更新电子邮件时,他们总是向我发送任务失败的响应,并且我验证了在更新电子邮件时它写得很好。 这是代码:

`private String vPassword, vEmail;
private Button btnValidate;
private EditText edContra, edEmail;
private TextView errorContra;
private ProgressDialog pDialog;
String sMail;

@Override
protected void onCreate (Bundle savedInstanceState) {
    super.onCreate (savedInstanceState);
    setContentView (R.layout.activity_pop_reset_email);

    pDialog = new ProgressDialog (this);
    vPassword = getIntent (). getStringExtra ("password");
    vEmail = getIntent (). getStringExtra ("email");
    btnValidar = findViewById (R.id.btnValidar);
    edContra = findViewById (R.id.passwordValidate);
    edEmail = findViewById (R.id.correoValidar);
    errorContra = findViewById (R.id.errorContraValidar);

    DisplayMetrics measures = new DisplayMetrics ();
    getWindowManager (). getDefaultDisplay (). getMetrics (measures);

    int width = measurements.widthPixels;
    int high = measures.heightPixels;

    getWindow (). setLayout ((int) (width * 0.85), (int) (height * 0.5));

    btnValidar.setOnClickListener (new View.OnClickListener () {
        @Override
        public void onClick (View view) {
            String edPassword = edContra.getText (). ToString ();
            sMail = edEmail.getText (). toString ();
            if (edPassword.equals (vPassword)) {
                Verify ();
            } else {
                errorContra.setVisibility (View.VISIBLE);
            }
        }
    });
}

// CHECK EMAIL
private void Verify () {
    if (! sCorreo.isEmpty () && sCorreo.contains ("@") && sCorreo.contains (".")) {
        errorContra.setVisibility (View.INVISIBLE);
        pDialog.setMessage ("Updating ...");
        pDialog.setCanceledOnTouchOutside (false);
        pDialog.show ();
        UpdateMail ();
    } else {
        errorContra.setVisibility (View.VISIBLE);
        errorContra.setText ("* Type Valid Mail.");
    }
}

// UPDATE EMAIL
private void UpdateMail () {
    FirebaseUser user = FirebaseAuth.getInstance (). GetCurrentUser ();

    user.updateEmail (sMail) .addOnCompleteListener (new OnCompleteListener <Void> () {
                @Override
                public void onComplete (@NonNull Task <Void> task) {
                    if (task.isSuccessful ()) {
                        Toast.makeText (PopResetEmail.this, "Mail Updated", Toast.LENGTH_SHORT) 
                        .show ();
                    } else {
                        Toast.makeText (PopResetEmail.this, "Email ERROR", Toast.LENGTH_SHORT) 
                        .show();                                          
                    }
                    pDialog.dismiss ();
                }
            });
}

// CLOSE ACTIVITY X
public void Close (View view) {
    finish ();
}`

已经验证在邮件更新时,它是否已从编辑文本中获取并转换为字符串。

当我按下按钮进行更新以在设备上进行测试时,这将显示在日志广播中:

2020-08-02 08:43:40.045 7910-7910/com.example.donmigue V/Toast: HANDLE HIDE: 
android.widget.Toast$TN@adee711 mView=null
2020-08-02 08:43:40.071 7910-7910/com.example.donmigue                     
D/ViewRootImpl@c39e34d[Toast]: setView = android.widget.LinearLayout@375c076 
TM=true MM=false
2020-08-02 08:43:40.071 7910-7910/com.example.donmigue V/Toast: Text: Dorr in 
android.widget.Toast$TN@adee711
//THIS IS A MISTAKE------------------
2020-08-02 08:43:40.096 7910-7910/com.example.donmigue E/GraphicExt: 
GraphicExtModuleLoader::CreateGraphicExtInstance false
//-----------------------------------
2020-08-02 08:43:40.097 7910-7910/com.example.donmigue 
D/ViewRootImpl@c39e34d[Toast]: Relayout returned: old=(0,55,720,1436) new= 
(230,714,490,791) req=(260,77)0 dur=19 res=0x7 s={true 3939788800} ch=true
2020-08-02 08:43:40.100 7910-7942/com.example.donmigue D/OpenGLRenderer: 
createReliableSurface : 0xbaba46c0(0xead46800)
2020-08-02 08:43:40.106 7910-7942/com.example.donmigue D/OpenGLRenderer: 
makeCurrent EglSurface : 0x0 -> 0xd6e49580
2020-08-02 08:43:40.109 7910-7942/com.example.donmigue I/GPUD: 
@gpudInitialize: 
successfully initialized with 4, dbg=0 mmdump_dbg=0
2020-08-02 08:43:40.110 7910-7942/com.example.donmigue I/GPUD: 
@gpudInitialize: 
successfully initialized with 4, dbg=0 mmdump_dbg=0
2020-08-02 08:43:40.115 7910-7910/com.example.donmigue 
D/ViewRootImpl@630eeec[PopResetEmail]: MSG_WINDOW_FOCUS_CHANGED 1 1
2020-08-02 08:43:40.115 7910-7910/com.example.donmigue D/InputMethodManager: 
prepareNavigationBarInfo() DecorView@a03932b[PopResetEmail]
2020-08-02 08:43:40.115 7910-7910/com.example.donmigue D/InputMethodManager: 
getNavigationBarColor() -855310
//THIS IS A MISTAKE------------------
2020-08-02 08:43:40.134 7910-7910/com.example.donmigue E/ViewRootImpl: 
sendUserActionEvent() mView returned.
//-----------------------------------
2020-08-02 08:43:40.138 7910-7942/com.example.donmigue D/OpenGLRenderer: 
makeCurrent EglSurface : 0xd6e49580 -> 0xb8fc7640
2020-08-02 08:43:40.140 7910-7910/com.example.donmigue 
D/ViewRootImpl@c39e34d[Toast]: MSG_RESIZED: frame=(230,714,490,791) ci= 
(0,0,0,0) 
vi=(0,0,260,77) or=1
2020-08-02 08:43:40.140 7910-7942/com.example.donmigue I/GPUD:                                                                                                                                             
@gpudInitialize: 
successfully initialized with 4, dbg=0 mmdump_dbg=0
2020-08-02 08:43:40.142 7910-7942/com.example.donmigue I/chatty: 
uid=10536(com.example.donmigue) RenderThread identical 3 lines