Skip to content
Skills Library
Programming · Building & coding

Android Gradle

/Android Gradle

Fix Android Gradle builds on the phone: AGP/Gradle compatibility, SDK/build-tools, memory, daemon, offline mode and common error messages. Use when configuration or plugin resolution fails.

Licence
MIT
Last repository change
12.11.2026

Assessment and security

90/ 100Class: good
Format15 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 12.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Fix Android Gradle builds on the phone: AGP/Gradle compatibility, SDK/build-tools, memory, daemon, offline mode and common error messages. Use when configuration or plugin resolution fails.

Original author description

Fix Android Gradle builds on the phone: AGP/Gradle compatibility, SDK/build-tools, memory, daemon, offline mode and common error messages. Use when configuration or plugin resolution fails.

How it works

  1. Bundled versions
  2. Compatibility
  3. Memory
  4. Common errors
  5. Debug a build
  6. Rules
Original SKILL.md headings · 66 lines, 370 words
SKILL.md preview
---
name: Android Gradle
description: Fix Android Gradle builds on the phone: AGP/Gradle compatibility, SDK/build-tools, memory, daemon, offline mode and common error messages. Use when configuration or plugin resolution fails.
---

# Android Gradle

## Bundled versions

| Component | Version |
|---|---|
| Gradle | 9.9.0 |
| AGP | 9.5.1 (this app); projects may use 8.13 or 9.x |
| compileSdk | 35 |
| build-tools | 36.0.0 (binarios 35.0.2 reetiquetados) |
| JDK | 21 (Termux) |
| Java source/target | 17 |

The build skill launches `GradleMain` directly, because `bin/gradle` breaks
under Android mksh (`Could not find or load main class "-Xmx64m"`).

## Compatibility

- AGP 9.5.x needs Gradle 9.x and JDK 17+; this bundle uses Gradle 9.9.0 successfully.
- AGP 9.x may need Gradle 9.x and newer build-tools; do not assume it works.
- If a project pins an older Gradle via its wrapper, set
  `OC_USE_WRAPPER=1` and ensure the distribution is available, or upgrade the
  project to AGP 9.5.1.

## Memory

```properties
org.gradle.jvmargs=-Xmx3g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8
org.gradle.daemon=false
org.gradle.offline=true
```

If the phone has 6 GB RAM or less, use `-Xmx2g`. A killed Gradle daemon often
looks like a random build failure.

## Common errors

| Error | Fix |
|---|---|
| `Failed to find Build Tools revision 34.0.0` | init script forces 36.0.0; add `buildToolsVersion '36.0.0'` to the module |
| `core-lambda-stubs.jar` missing | use toolchain v5+; the jar is bundled |
| `aapt2` format/exec error | use the 16 KB aarch64 aapt2; check ABI |
| `java.io.tmpdir ... doesn't exist` | let `build.sh` use `$HOME/.cache/tmp`; do not create `$PREFIX/tmp` by hand |
| `Could not resolve ...` | dependency not in offline cache; use `android-lib-cache`, not a raw online run |
| `checkDebugAarMetadata` / AndroidX warning | add `android.useAndroidX=true` to `gradle.properties` |
| duplicate `kotlin-stdlib` classes | force one stdlib version (1.8+ merges jdk7/jdk8) |
| `Unsupported class file major version` | JDK too new/old for the AGP/Kotlin version |
| `SDK location not found` | `local.properties` or `ANDROID_HOME` missing |

## Debug a build

```sh
bash ~/.config/opencode/skills/android-build/scripts/build.sh . debug
```

For more detail, run the same Gradle command with `--stacktrace --info` (edit a
copy of build.sh or invoke GradleMain directly). Read the **first** error, not
the last "BUILD FAILED".

## Rules

- Do not edit the bundled Gradle distribution.
- Do not commit `local.properties`, `.gradle/` or `build/`.
- Keep `android.aapt2FromMavenOverride` pointing at the bundled aapt2.

Versions

The database has no other skills named Android Gradle.

Database snapshot: 13.11.2026 · package version 0045b964345b (SHA-256 digest of the entire package)

Downloads in the last 30 days: 3 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90Android Project
    Create or repair an Android Gradle project on this phone: modules, AGP/Gradle versions, manifest, package name, and a first build. Use when starting a new app or when the project structure is broken.
  • 100android-agp-upgrade
    Upgrade an Android project to Android Gradle Plugin (AGP) 9. Use when migrating to AGP 9, updating Gradle build files, migrating to built-in Kotlin, or adopting the new AGP DSL.
  • 90kotlin-android
    Build and upgrade native Android applications with Kotlin, Compose/View UI and lifecycle-aware work. Use when implementing Android screens, navigation, permissions or background jobs; coordinate Kotlin, Gradle, AGP and SDK compatibility.
  • 100agp-9-upgrade
    Upgrades, or migrates, an Android project to use Android Gradle Plugin (AGP) version 9. Do not use this skill for migrating Kotlin Multiplatform (KMP) projects.
  • 90Android Build
    Build, sign and locate Android APKs locally on this phone with Gradle, JDK 21 and the on-device Android SDK. Use when the user asks to compile, rebuild, package or install an Android project on the device.
  • 100gradle-build-performance
    Debug and optimize Android/Gradle build performance. Use when builds are slow, investigating CI/CD performance, analyzing build scans, or identifying compilation bottlenecks.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.