com.google.firebase.FirebaseException: An internal error has occurred. [ API key not valid. Please pass a valid API key. ]
Hy i was also facing this issue.
Solution: change version of google services at project level gradle and sync your project and reinstall.
classpath 'com.google.gms:google-services:4.3.0'
What worked for me was going to "Build" -> "Clean Project" and running it.
(I also tried syncing Firebase on Android Studio, recreated google-services.json, but none actually worked for me until cleaning the project)
Your API key from your Firebase must match with the Key of your google-services.json file to solve this issue, check the image here check image from android studio
check image from firebase
After doing this, Goto your android studio click Tools > AVD Manager > Choose your emulator and Wipe Data Now run the app again