@echo off
echo ========================================
echo Deep Clean - Flutter & Gradle Cache
echo ========================================

echo.
echo 1. Stopping all Java and Gradle processes...
taskkill /f /im java.exe 2>nul
taskkill /f /im gradle.exe 2>nul

echo.
echo 2. Cleaning Flutter cache...
C:\sdk\flutter\bin\flutter clean

echo.
echo 3. Cleaning Gradle cache (if accessible)...
if exist "%USERPROFILE%\.gradle" (
    echo Removing Gradle cache...
    rmdir /s /q "%USERPROFILE%\.gradle" 2>nul
)

echo.
echo 4. Cleaning Android build cache...
if exist "android\.gradle" (
    rmdir /s /q "android\.gradle" 2>nul
)
if exist "android\build" (
    rmdir /s /q "android\build" 2>nul
)
if exist "android\app\build" (
    rmdir /s /q "android\app\build" 2>nul
)

echo.
echo 5. Getting Flutter dependencies...
C:\sdk\flutter\bin\flutter pub get

echo.
echo 6. Testing Gradle wrapper...
cd android
gradlew --version
cd ..

echo.
echo ========================================
echo Deep clean completed!
echo ========================================
pause 