xinli/xinli-App/修复并打包.bat
2025-12-02 15:12:55 +08:00

53 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 修复JDK版本问题并重新打包
echo ========================================
echo.
echo [1/4] 停止Gradle守护进程...
call gradlew.bat --stop
echo.
echo [2/4] 清理构建缓存...
call gradlew.bat clean
echo.
echo [3/4] 删除Android Studio的Gradle缓存...
if exist "%USERPROFILE%\.gradle\caches" (
echo 正在清理 %USERPROFILE%\.gradle\caches...
rd /s /q "%USERPROFILE%\.gradle\caches" 2>nul
)
echo.
echo [4/4] 开始构建Debug APK...
echo 这可能需要几分钟,请耐心等待...
echo.
call gradlew.bat assembleDebug
if %ERRORLEVEL% EQU 0 (
echo.
echo ========================================
echo ✓ 构建成功!
echo ========================================
echo.
echo APK位置
echo app\build\outputs\apk\debug\app-debug.apk
echo.
echo 可以用以下命令查找APK
echo dir /s /b app-debug.apk
echo.
) else (
echo.
echo ========================================
echo ✗ 构建失败!
echo ========================================
echo.
echo 请检查错误信息,或尝试:
echo 1. 使用Android Studio打开项目并构建
echo 2. 运行 快速安装SDK.bat 检查SDK配置
echo.
)
pause