Build Android APK via Myket maven mirror (verified)

- Myket mirror serves maven2 layout at root https://maven.myket.ir (proxies
  Maven Central + Google/AGP); android/build.gradle uses it
- gradle-mirror.init.gradle template injects the mirror into all modules and
  pins build-tools 36 + Java 17 (this env lacks build-tools 35 / JDK 21)
- ANDROID.md updated with the exact working build command
- Produces app-debug.apk (~4.5 MB)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-04 15:22:34 +03:30
parent 38691154c8
commit 84ccbea56a
3 changed files with 52 additions and 39 deletions
+29 -31
View File
@@ -1,42 +1,40 @@
// Route Gradle (Android Gradle Plugin + deps) through a Maven mirror — for
// networks where dl.google.com / repo.maven.apache.org are blocked (Iran).
// Build APK behind Iran's network using the Myket maven mirror.
//
// 1) copy this file to: android/gradle-mirror.init.gradle
// 2) set MIRROR (and GOOGLE if your Nexus exposes Google's repo separately)
// 3) build: gradlew.bat assembleDebug --init-script gradle-mirror.init.gradle
// A Nexus "maven group" that proxies Maven Central AND Google's android repo:
def MIRROR = "https://mirror.soroushasadi.com/repository/maven-public/"
// If Google's repo is a separate proxy, set it here (else leave = MIRROR):
def GOOGLE = MIRROR
// copy to: android/gradle-mirror.init.gradle (git-ignored)
// build: java -classpath gradle\wrapper\gradle-wrapper.jar \
// org.gradle.wrapper.GradleWrapperMain assembleDebug \
// --init-script gradle-mirror.init.gradle --no-daemon
//
// NOTE: the mirror serves the maven2 layout at the ROOT (no /maven2 suffix).
def MIRROR = "https://maven.myket.ir"
settingsEvaluated { settings ->
settings.pluginManagement {
repositories {
maven { url GOOGLE }
maven { url MIRROR }
}
}
settings.pluginManagement.repositories { maven { url MIRROR } }
try {
settings.dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
maven { url GOOGLE }
maven { url MIRROR }
}
}
settings.dependencyResolutionManagement.repositories { maven { url MIRROR } }
} catch (ignored) { }
}
allprojects {
buildscript {
repositories {
maven { url GOOGLE }
maven { url MIRROR }
buildscript { repositories { maven { url MIRROR } } }
repositories { maven { url MIRROR } }
// Environment workarounds (only needed when the exact SDK build-tools / JDK
// that Capacitor 8 expects aren't present — e.g. JDK 17 instead of 21, and
// build-tools 36 instead of 35). Remove on a CI with JDK 21 + build-tools 35.
afterEvaluate { p ->
if (p.plugins.hasPlugin('com.android.application') || p.plugins.hasPlugin('com.android.library')) {
p.android {
buildToolsVersion '36.0.0'
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}
}
p.tasks.withType(JavaCompile).configureEach {
sourceCompatibility = '17'
targetCompatibility = '17'
}
}
repositories {
maven { url GOOGLE }
maven { url MIRROR }
}
}