“Chain validation failed”在使用Firebase时在Android Studio中出现错误。

huangapple go评论144阅读模式
英文:

"Chain validation failed" in Android Studio with Firebase

问题

当我尝试以调试模式运行Java Android代码时,我遇到了以下错误:

> 在执行请求时出现异常:链验证失败

我已经尝试将 Gradle > app > Tasks > Signing Report 中的SHA1代码添加到Firebase主项目配置中。

我仍然得到之前的错误。
Gradle控制台只给我一个调试SHA1!!!

英文:

When I try to run the java android Code in debug mode

@Override
   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_main);
       Firebase.setAndroidContext(this);
       Firebase firebase = new Firebase("https://androidcookbook-98385.firebaseio.com");
       firebase.createUser("myemail@mydomain.com", "mypassword", new Firebase.ValueResultHandler<Map<String, Object>>(){

           @Override
           public void onSuccess(Map<String, Object> stringObjectMap) {
               Log.i("Firebase", "successfully created user user account with uid:"+ stringObjectMap.get("uid") );
           }

           @Override
           public void onError(FirebaseError firebaseError) {
               Log.i("Firebase", "Error on creating user!!!! "+firebaseError.getMessage());
           }
       });
   }

I get the error

> There was an exception while performing the request: Chain validation failed

I have tried to add the SHA1 code from Gradle > app > Tasks > Signing Report to the Firebase main project configuration .

I still get the previous error
The Gradle console gives me only a debug sha1!!!

答案1

得分: 13

我在Flutter应用中遇到了类似的Firebase问题。API返回:

com.google.firebase.FirebaseException: 发生了内部错误。[ 链验证失败 ]

事实证明,是因为我的Android模拟器上的日期和时间完全不正确。冷启动重置了日期和时间,Firebase异常问题得以解决。

英文:

I had a similar problem with Firebase in a Flutter app. The API returned:

com.google.firebase.FirebaseException: An internal error has occurred. [ Chain validation failed ]

It turned out to be the date and time on my Android Emulator was completely out. A cold boot reset the date and time and the Firebase exception issue was solved.

huangapple
  • 本文由 发表于 2020年4月6日 21:50:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/61061378.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定