Files
tiku_andriod/clean_and_build.ps1
爱喝水的木子 98fc3ff879
Some checks failed
Build and Release APK / build (push) Has been cancelled
Build and Release APK / release (push) Has been cancelled
Initial commit: Android题库APP - Jetpack Compose + Retrofit
2026-04-01 18:32:18 +08:00

45 lines
1.7 KiB
PowerShell
Raw Permalink 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.
# 清理 Gradle 缓存和项目构建目录
Write-Host "开始清理..." -ForegroundColor Green
# 清理项目 build 目录
Write-Host "清理项目 build 目录..." -ForegroundColor Yellow
if (Test-Path ".\build") {
Remove-Item -Path ".\build" -Recurse -Force
Write-Host "已清理 build 目录" -ForegroundColor Green
}
# 清理 app build 目录
Write-Host "清理 app build 目录..." -ForegroundColor Yellow
if (Test-Path ".\app\build") {
Remove-Item -Path ".\app\build" -Recurse -Force
Write-Host "已清理 app build 目录" -ForegroundColor Green
}
# 清理有问题的 Gradle 缓存
Write-Host "清理 Gradle 缓存..." -ForegroundColor Yellow
$gradleCachePath = "C:\Users\lee\.gradle\caches\8.13"
if (Test-Path $gradleCachePath) {
# 清理 groovy-dsl 缓存
$groovyDslPath = Join-Path $gradleCachePath "groovy-dsl\070ba2b51e09fa9c0e770e7c757cc8a3"
if (Test-Path $groovyDslPath) {
Remove-Item -Path $groovyDslPath -Recurse -Force -ErrorAction SilentlyContinue
Write-Host "已清理 groovy-dsl 缓存" -ForegroundColor Green
}
# 清理 transforms 缓存
$transformsPath = Join-Path $gradleCachePath "transforms\44e7089f2786c22da3ed6c59f9f06cc8"
if (Test-Path $transformsPath) {
Remove-Item -Path $transformsPath -Recurse -Force -ErrorAction SilentlyContinue
Write-Host "已清理 transforms 缓存" -ForegroundColor Green
}
}
Write-Host "`n清理完成!" -ForegroundColor Green
Write-Host "`n现在开始构建..." -ForegroundColor Yellow
# 执行构建
.\gradlew.bat clean assembleRelease --no-daemon --refresh-dependencies
Write-Host "`n构建完成!" -ForegroundColor Green
Write-Host "APK 文件位置app\build\outputs\apk\release\app-release-unsigned.apk" -ForegroundColor Cyan