| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- @echo off
- echo ========================================
- echo 切换 Gradle 镜像源
- echo ========================================
- echo.
- echo 请选择镜像源:
- echo 1. 腾讯云镜像(推荐)
- echo 2. 阿里云镜像
- echo 3. 官方源(默认)
- echo.
- set /p choice=请输入选项 (1-3):
- set "gradleProps=android\gradle\wrapper\gradle-wrapper.properties"
- if "%choice%"=="1" (
- echo.
- echo 切换到腾讯云镜像...
- powershell -Command "(Get-Content '%gradleProps%') -replace 'distributionUrl=https\\://services.gradle.org/distributions/gradle-8.11.1-all.zip', 'distributionUrl=https\\://mirrors.cloud.tencent.com/gradle/gradle-8.11.1-all.zip' | Set-Content '%gradleProps%'"
- echo 已切换到腾讯云镜像!
- ) else if "%choice%"=="2" (
- echo.
- echo 切换到阿里云镜像...
- powershell -Command "(Get-Content '%gradleProps%') -replace 'distributionUrl=https\\://services.gradle.org/distributions/gradle-8.11.1-all.zip', 'distributionUrl=https\\://mirrors.aliyun.com/gradle/gradle-8.11.1-all.zip' | Set-Content '%gradleProps%'"
- echo 已切换到阿里云镜像!
- ) else if "%choice%"=="3" (
- echo.
- echo 切换到官方源...
- powershell -Command "(Get-Content '%gradleProps%') -replace 'distributionUrl=https\\://mirrors.*gradle-8.11.1-all.zip', 'distributionUrl=https\\://services.gradle.org/distributions/gradle-8.11.1-all.zip' | Set-Content '%gradleProps%'"
- echo 已切换到官方源!
- ) else (
- echo 无效选项!
- pause
- exit /b 1
- )
- echo.
- echo 当前配置:
- type "%gradleProps%" | findstr distributionUrl
- echo.
- pause
|