#!/bin/bash
# Check Android development environment

set -e

echo "🔍 Checking Android development environment..."
echo ""

# Check ADB
if command -v adb &> /dev/null; then
    echo "✅ ADB installed: $(adb version | head -1)"
else
    echo "❌ ADB not found"
fi

# Check Android SDK
if [ -d "$HOME/Android/Sdk" ]; then
    echo "✅ Android SDK found at: $HOME/Android/Sdk"
else
    echo "❌ Android SDK not found at: $HOME/Android/Sdk"
fi

# Check NDK
if [ -d "$HOME/Android/Sdk/ndk" ]; then
    NDK_VERSION=$(ls "$HOME/Android/Sdk/ndk" | head -1)
    echo "✅ NDK found: $NDK_VERSION"
else
    echo "❌ NDK not found"
fi

# Check Rust
if command -v rustc &> /dev/null; then
    echo "✅ Rust installed: $(rustc --version)"
else
    echo "❌ Rust not found"
fi

# Check Cargo
if command -v cargo &> /dev/null; then
    echo "✅ Cargo installed: $(cargo --version)"
else
    echo "❌ Cargo not found"
fi

# Check for connected devices
echo ""
echo "📱 Connected Android devices:"
if adb devices | grep -q "device$"; then
    adb devices | grep "device$"
else
    echo "⚠️  No devices connected"
fi

echo ""
echo "🔍 Environment check complete!"
