xinli/xinli-App/初始化Gradle.bat
2025-11-23 10:19:32 +08:00

54 lines
1.3 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
chcp 65001 >nul
echo ========================================
echo 初始化Gradle Wrapper
echo ========================================
echo.
REM 检查是否已存在gradle-wrapper.jar
if exist "gradle\wrapper\gradle-wrapper.jar" (
echo Gradle Wrapper已存在跳过初始化
pause
exit /b 0
)
echo 正在下载Gradle Wrapper...
echo.
REM 检查是否有gradle命令
where gradle >nul 2>&1
if %errorlevel% neq 0 (
echo 错误未找到gradle命令
echo.
echo 请选择以下方式之一:
echo 1. 安装Gradle并添加到PATH
echo 2. 使用Android Studio打开项目会自动生成
echo 3. 手动下载gradle-wrapper.jar
echo.
echo 手动下载地址:
echo https://raw.githubusercontent.com/gradle/gradle/v8.0.0/gradle/wrapper/gradle-wrapper.jar
echo.
echo 下载后保存到: gradle\wrapper\gradle-wrapper.jar
pause
exit /b 1
)
echo 使用gradle wrapper命令初始化...
gradle wrapper --gradle-version 8.0
if %errorlevel% equ 0 (
echo.
echo ========================================
echo Gradle Wrapper初始化成功
echo ========================================
) else (
echo.
echo ========================================
echo 初始化失败,请检查错误信息
echo ========================================
)
echo.
pause