"Chain validation failed" in Android Studio with Firebase
Asked Answered
R

2

6

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("[email protected]", "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!!!

Rubric answered 6/4, 2020 at 13:50 Comment(2)
double-check you have the JSON file placed in the proper location. and check your SHA1 is not for the unit test. you need to copy the debug SHA1 for the application main sourceGismo
all the SHA1 codes are the same, be it for debug/debug or debugUnitTest/debugRubric
T
16

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.

Traject answered 30/8, 2021 at 15:15 Comment(1)
This one helped me. Thank you.Mucilaginous
T
1

I had similar issue in flutter. You should reset your time and timezone on the mobile device or simulator. It worked for me.

Terrel answered 12/3 at 12:19 Comment(1)
This is correct. Been a long time since I used my android tv emulator. Old date's stuck too. So i did a cold reboot.Milinda

© 2022 - 2024 — McMap. All rights reserved.