mirror of
https://github.com/jahruz67/luncher-relo.git
synced 2026-08-08 18:14:06 +00:00
88 lines
2.5 KiB
Batchfile
88 lines
2.5 KiB
Batchfile
@echo off
|
|
cd /d "%~dp0"
|
|
|
|
echo ========================================
|
|
echo Building Luncher APK
|
|
echo ========================================
|
|
echo.
|
|
|
|
:: Find Gradle from the wrapper dists cache
|
|
set "GRADLE_BAT="
|
|
for /f "delims=" %%i in ('dir /s /b "%USERPROFILE%\.gradle\wrapper\dists\gradle-8.14*\bin\gradle.bat" 2^>nul') do (
|
|
set "GRADLE_BAT=%%i"
|
|
goto :found_gradle
|
|
)
|
|
for /f "delims=" %%i in ('dir /s /b "%USERPROFILE%\.gradle\wrapper\dists\gradle-8.14.3*\bin\gradle.bat" 2^>nul') do (
|
|
set "GRADLE_BAT=%%i"
|
|
goto :found_gradle
|
|
)
|
|
for /f "delims=" %%i in ('dir /s /b "%USERPROFILE%\.gradle\wrapper\dists\gradle-9*\bin\gradle.bat" 2^>nul') do (
|
|
set "GRADLE_BAT=%%i"
|
|
goto :found_gradle
|
|
)
|
|
|
|
:: Also check Android Studio bundled Gradle
|
|
if exist "C:\Program Files\Android\Android Studio\plugins\gradle-plugin\lib\gradle-api-9.3.0.jar" (
|
|
echo Found Android Studio with Gradle 9.3.0 plugin.
|
|
echo.
|
|
echo NOTE: Android Studio bundles Gradle as a plugin, not a standalone install.
|
|
echo The build will generate a Gradle wrapper first.
|
|
)
|
|
|
|
:found_gradle
|
|
|
|
if defined GRADLE_BAT (
|
|
echo [1/4] Found Gradle at: %GRADLE_BAT%
|
|
echo.
|
|
) else (
|
|
echo [1/4] Gradle not found in cache. Will generate wrapper from Android Studio...
|
|
echo.
|
|
)
|
|
|
|
:: Generate Gradle wrapper if it doesn't exist
|
|
if not exist gradlew.bat (
|
|
echo [2/4] Generating Gradle wrapper...
|
|
if defined GRADLE_BAT (
|
|
"%GRADLE_BAT%" wrapper --gradle-version=8.14
|
|
) else (
|
|
echo ERROR: No Gradle installation found.
|
|
echo.
|
|
echo Please open this project in Android Studio and let it sync once.
|
|
echo It will generate the Gradle wrapper automatically.
|
|
echo.
|
|
echo Alternatively, install Gradle manually from: https://gradle.org/install/
|
|
pause
|
|
exit /b 1
|
|
)
|
|
if errorlevel 1 (
|
|
echo ERROR: Failed to generate Gradle wrapper.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
echo Gradle wrapper generated successfully.
|
|
echo.
|
|
)
|
|
|
|
echo [3/4] Cleaning old build...
|
|
call gradlew.bat clean 2>&1
|
|
if errorlevel 1 (
|
|
echo WARNING: Clean step had issues, continuing...
|
|
)
|
|
|
|
echo [4/4] Building release APK...
|
|
call gradlew.bat assembleRelease 2>&1
|
|
if errorlevel 1 (
|
|
echo.
|
|
echo ERROR: Build failed. Check the output above for details.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo.
|
|
echo ========================================
|
|
echo BUILD COMPLETE!
|
|
echo ========================================
|
|
echo.
|
|
echo APK location: app\build\outputs\apk\release\app-release.apk
|
|
echo.
|
|
pause |