Aya*_*yan 6 android android-wifi firebase firebase-authentication
在Android上使用移动数据使用Firebase身份验证时 ,我在运行应用时遇到以下错误:
com.google.firebase.FirebaseException: An internal error has occured. [ Internal error. ]
at com.google.android.gms.internal.zzacq.zzbN(Unknown Source)
at com.google.android.gms.internal.zzacn$zzg.zza(Unknown Source)
at com.google.android.gms.internal.zzacy.zzbO(Unknown Source)
at com.google.android.gms.internal.zzacy$zza.onFailure(Unknown Source)
at com.google.android.gms.internal.zzact$zza.onTransact(Unknown Source)
at android.os.Binder.execTransact(Binder.java:412)
at dalvik.system.NativeStart.run(Native Method)
Run Code Online (Sandbox Code Playgroud)
但是,当我使用wifi运行相同的应用程序时,没有显示错误并且身份验证通常没有任何错误,并使用以下消息而不是上述错误:
Considering local module com.google.android.gms.firebase_database:2 and remote module com.google.android.gms.firebase_database:2
Selected remote version of com.google.android.gms.firebase_database, version >= 2
Run Code Online (Sandbox Code Playgroud)
我用来验证/创建用户的代码如下:
mAuth.createUserWithEmailAndPassword(emailSignup, passwordSignup)
.addOnCompleteListener(LogInSignUp.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task)
{
Log.d(TAG, "createUserWithEmail:onComplete:" + task.isSuccessful());
// If sign in fails, display a message to the user. If sign in succeeds
// the auth state listener will be notified and logic to handle the
// signed in user can be handled in the listener.
if (!task.isSuccessful())
{
Toast.makeText(LogInSignUp.this, "Authentication failed.",Toast.LENGTH_SHORT).show();
task.getException().printStackTrace();
dialogLoading.cancel();
}
else
{
String clientUID=mAuth.getCurrentUser().getUid();
FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference user = database.getReference("clients");
user.push();
ClientProfile c=new ClientProfile();
c.setEmail(emailSignup);
c.setName(nameSignup);
c.setPassword(passwordSignup);
user.child(clientUID).setValue(c);
}
}
});
Run Code Online (Sandbox Code Playgroud)
我在用
compile 'com.google.firebase:firebase-auth:9.0.2' 在我的gradle文件中在清单文件中:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
| 归档时间: |
|
| 查看次数: |
1765 次 |
| 最近记录: |