@echo off
setlocal EnableExtensions
chcp 65001 >nul
cd /d "%~dp0"
if not defined JAVA_HOME (
 if exist "%ProgramFiles%\Android\Android Studio\jbr" set "JAVA_HOME=%ProgramFiles%\Android\Android Studio\jbr"
)
if not defined JAVA_HOME (
 echo ERROR: JAVA_HOME is not set and Android Studio JBR was not found.
 pause
 exit /b 1
)
set "PATH=%JAVA_HOME%\bin;%PATH%"
call gradlew.bat clean assembleDebug
if errorlevel 1 (
 echo BUILD_FAILED
 pause
 exit /b 1
)
echo APK_READY=app\build\outputs\apk\debug\app-debug.apk
pause
