Emulator Debugging
When to use this skill
- •When the Flutter app fails to connect to Firestore/Auth/Functions in DEV.
- •When physical Android devices show "Connection refused" or network errors.
- •When switching between Emulators and Production.
How to use it
- •Check Initialization Order:
- •Verify
Firebase.initializeApp()runs before any emulator connection code. - •Verify emulator config runs immediately after.
- •Verify
- •Verify Host Configuration:
- •Android Emulator: Use
10.0.2.2. - •Physical Device: Use the computer's local LAN IP (e.g.,
192.168.1.x). DO NOT uselocalhostor127.0.0.1. - •Web: Use
localhost.
- •Android Emulator: Use
- •Network Security (Android):
- •Ensure
android/app/src/main/res/xml/network_security_config.xmlallows cleartext traffic for the emulator IP. - •Ensure
AndroidManifest.xmlreferences this config.
- •Ensure
- •Auth Emulator Check:
- •Remember: Google Sign-In and other 3rd party providers often fail on physical devices pointing to the Auth Emulator due to redirect issues. Prefer real Auth for physical device testing if possible, or ensure strict redirect URL handling.