#!/bin/bash # Android Emulator Launch Script - Network Fix Mode # Addresses DNS/network connectivity issues that cause ANRs and Play Services failures # Author: Matthew Raymer echo "🚀 Launching Android Emulator - Network Fix Mode..." # Check if emulator command exists if ! command -v emulator &> /dev/null; then echo "❌ Error: Android emulator not found!" echo "Please install Android Studio and add emulator to PATH" exit 1 fi # Check if AVD exists if ! emulator -list-avds | grep -q "TimeSafari_Emulator"; then echo "❌ Error: TimeSafari_Emulator AVD not found!" echo "Available AVDs:" emulator -list-avds exit 1 fi echo "✅ Environment checks passed" echo "🌐 Starting emulator with network fixes..." # Launch emulator with network fixes, performance tuning, and clean state QT_QPA_PLATFORM=xcb \ emulator -avd TimeSafari_Emulator \ -gpu host \ -accel on \ -cores 6 \ -memory 4096 \ -no-boot-anim \ -no-snapshot-load \ -wipe-data \ -dns-server 8.8.8.8,1.1.1.1 \ -feature -Bluetooth echo "🎯 Emulator launched with network fixes!" echo "" echo "📋 Network Fixes Applied:" echo " - Explicit DNS servers (8.8.8.8, 1.1.1.1)" echo " - Clean state (wipe-data)" echo " - No snapshot loading" echo " - 6 CPU cores allocated" echo " - 4GB RAM allocated" echo " - Fast startup (no boot animation)" echo " - Bluetooth disabled (prevents hangs)" echo "" echo "🔍 Network Verification Commands:" echo " # Check airplane mode" echo " adb -e shell settings get global airplane_mode_on" echo "" echo " # Check network interfaces" echo " adb -e shell ip addr; adb -e shell ip route" echo "" echo " # Test DNS resolution" echo " adb -e shell ping -c1 8.8.8.8" echo " adb -e shell ping -c1 connectivitycheck.gstatic.com" echo "" echo "⚠️ Note: This will wipe emulator data for clean network state"