Files
odboy 8a14027e22 feat: 新增 android 编译镜像 compile-android-gradle8x
基于 runtime-jdk21,内置 JDK 21 + Gradle 8.14.3 + Android SDK
(platform-tools、platforms 35/36、build-tools 35.0.0、NDK 27、CMake 3.22.1)。
Android 只出 apk/aar,无运行阶段,因此只加编译镜像。

- 组件包由 build.sh 预下载并校验 sha1,Dockerfile 按各包实际目录结构解压
  (不用 sdkmanager 在线安装:它在 Docker 里从镜像站取到残包,报 ZipFile unknown archive)
- Gradle 发行包走阿里云;gradle-init.gradle 把依赖仓库改写为阿里云代理
- 构建末尾按真实文件自检 adb/android.jar/aapt2/ndk-build/cmake
2026-11-15 12:52:59 +08:00

33 lines
1.3 KiB
Groovy
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 全局 init 脚本(镜像内 ${GRADLE_USER_HOME}/init.d/init.gradle),对容器里所有 Gradle 构建生效。
// 只替换仓库地址,其余保持 Gradle 默认行为;项目里的 repositoryMode / 私有仓库配置仍按各自 build.gradle 解析。
// 阿里云代理的三类仓库:Google(androidx / build-tools 依赖)、Maven Central、Gradle Plugin Portal
def mirrors = [
'https://dl.google.com/dl/android/maven2': 'https://maven.aliyun.com/repository/google',
'https://repo.maven.apache.org/maven2' : 'https://maven.aliyun.com/repository/public',
'https://repo1.maven.org/maven2' : 'https://maven.aliyun.com/repository/public',
'https://plugins.gradle.org/m2' : 'https://maven.aliyun.com/repository/gradle-plugin',
]
def redirect = { RepositoryHandler repos ->
repos.configureEach { repo ->
if (repo instanceof MavenArtifactRepository) {
def url = repo.url.toString()
def target = mirrors.find { from, to -> url.startsWith(from) }
if (target) {
repo.url = target.value
}
}
}
}
allprojects {
buildscript {
redirect(repositories)
}
redirect(repositories)
}
settingsEvaluated { settings ->
redirect(settings.pluginManagement.repositories)
}