本文介绍了Firebase令牌验证错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 E / StorageUtil:error 使用firebase存储上传文件,但是当我上传时,获取令牌java.util.concurrent.ExecutionException:com.google.android.gms.internal.zzand:请在尝试获取令牌之前登录。 我用Google搜索了一下,但无法得到答案! 我已经在firebase中登录了。 解决方案我想你在上传文件之前没有登录。在启动程序活动的onCreate()中,试试这个代码 FirebaseAuth mAuth = FirebaseAuth.getInstance(); 然后在onStart(), FirebaseUser user = mAuth.getCurrentUser(); if(user!= null){ //做你的东西} else { signInAnonymously(); $ b signInAnonymously() @Override public void setInnonymous(){ mAuth.signInAnonymously() void onSuccess(AuthResult authResult){ //做你的东西} }) .addOnFailureListener(this,new OnFailureListener(){ @Override public void onFailure(@NonNull exception exception){ Log.e(TAG,signInAnonymously:FAILURE,exception); } }); 这可能会解决您的问题I am using firebase storage to upload files , but when I upload I am getting this errorE/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.android.gms.internal.zzand: Please sign in before trying to get a token.I googled it but couldn't get answer for it! I have signed in, in firebase. 解决方案 I think you didn't sign before uploading files. In onCreate() of launcher activity, try this codeFirebaseAuth mAuth = FirebaseAuth.getInstance(); Then in onStart(), FirebaseUser user = mAuth.getCurrentUser();if (user != null) { // do your stuff} else { signInAnonymously();}signInAnonymously()private void signInAnonymously() { mAuth.signInAnonymously().addOnSuccessListener(this, new OnSuccessListener<AuthResult>() { @Override public void onSuccess(AuthResult authResult) { // do your stuff } }) .addOnFailureListener(this, new OnFailureListener() { @Override public void onFailure(@NonNull Exception exception) { Log.e(TAG, "signInAnonymously:FAILURE", exception); } });}This may solve your problem 这篇关于Firebase令牌验证错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-22 06:33