← Back to Skills Marketplace
oahc09

Android Project Generator

by oahc09 · GitHub ↗ · v1.3.0 · MIT-0
cross-platform ✓ Security Clean
109
Downloads
0
Stars
0
Active Installs
4
Versions
Install in OpenClaw
/install android-project-generator
Description
Generate Android projects that compile on the first real build, including optional JNI/NDK/CMake native setup. Use when creating new Android apps, configurin...
README (SKILL.md)

\r

Android Project Generator Skill\r

\r

Purpose\r

\r Ensure AI-generated Android projects compile successfully on the first attempt by providing: \r

  1. Version compatibility knowledge — AGP/Gradle/JDK/Kotlin version matrices\r
  2. Standardized configuration templates — Complete, working Gradle configurations\r
  3. Environment detection — Adapt to local JDK/SDK versions\r
  4. Post-generation validation — Verify compilation succeeds
  5. APK build orchestration — Distinguish between scaffolding-only, build-failed, and compiled APK states
  6. Native integration guidance — Detect native intent and scaffold JNI/NDK/CMake-compatible project configuration \r

Runtime & Safety Requirements\r

\r Before using this skill on a production or sensitive machine, verify:\r \r

  • Required binaries are present in PATH: python, java, and at least one of gradle/gradlew.\r
  • Android tooling is installed on disk for real build validation: Android SDK (platforms/build-tools/cmdline-tools/licenses), and optional NDK+CMake for native flows.\r
  • Environment variables are correctly scoped: JAVA_HOME (recommended), ANDROID_HOME or ANDROID_SDK_ROOT, optional ANDROID_NDK_HOME or NDK_HOME for native workflows.\r
  • Local command execution is acceptable in the current host policy.\r
  • Device interactions (adb install, adb shell am start) are allowed for connected devices/emulators.\r
  • Build-time network access is acceptable (for Gradle wrapper/dependency resolution).\r \r This skill runs local commands and may perform build/device operations; treat it as operational code, not documentation-only guidance. It does not request API keys, tokens, or cloud credentials by design.\r \r

Credentials\r

\r This skill does not require cloud credentials, API keys, or tokens.\r \r It does rely on local environment variables and installed binaries/tooling:\r \r

  • Env vars inspected/used: JAVA_HOME, ANDROID_HOME/ANDROID_SDK_ROOT, and for native projects ANDROID_NDK_HOME/NDK_HOME.\r
  • Binaries/tooling expected: java, gradle/gradlew, Android SDK/NDK on disk, and optional adb for install/launch verification.\r \r The scripts do not intentionally exfiltrate data, but they do run subprocesses that may:\r \r
  • access network resources (for Gradle wrapper/dependency downloads)\r
  • interact with attached devices/emulators (adb)\r \r

When to Use This Skill\r

\r Trigger this skill when:

  • Creating a new Android project from scratch
  • Generating Gradle configuration files (build.gradle.kts, settings.gradle.kts)
  • Setting up Android project structure
  • Adding or planning C/C++ native code (JNI, NDK, CMake, externalNativeBuild)
  • User asks to "create an Android app" or "generate an Android project"
  • Debugging Gradle version compatibility issues \r

Workflow\r

\r

Phase 1: Audit the Build Environment First

If the project is meant to build on the current machine, do not generate files yet. Audit the environment first:

python scripts/detect_env.py

Treat this phase as mandatory for local project generation because most "AI generated Android project won't compile" failures are environment mismatches, not template mistakes.

This outputs:

  • JDK version → determines AGP version range
  • JAVA_HOME configuration and version
  • PATH java executable and version
  • Gradle CLI JDK source (JAVA_HOME vs PATH)
  • Android SDK path and build-tools versions
  • Installed Android platforms
  • cmdline-tools / licenses readiness
  • NDK version (if present)
  • Recommended configuration for the detected environment
  • Environment assessment with blocking issues and warnings

If ready_for_build is false:

  • Explain the blocking issues clearly
  • Prefer fixing the environment before generating a "build-ready" project
  • If the user still wants files generated, say the project is scaffolding-only until the environment issues are fixed

If the environment status is degraded:

  • Explain why the build is risky rather than blocked
  • Most commonly this means JDK 17 exists but JAVA_HOME is missing, so Gradle is falling back to PATH
  • Recommend aligning Android Studio, CLI Gradle, and project-level JDK configuration before claiming the build setup is stable

Phase 2: Select Configuration Profile

Base the profile on audited environment data, not guesswork: \r | Profile | AGP | Gradle | JDK | Use Case |\r |---------|-----|--------|-----|----------|\r | stable | 8.7.0 | 8.9 | 17+ | Recommended for most projects |\r | latest | 9.1.0 | 9.3.1 | 17+ | New features, Android 16+ |\r | legacy | 7.4.2 | 7.5 | 11+ | Older environments |\r \r Default to "stable" profile only when the environment is ready for it.

Use this decision order:

  1. If JDK 17+, platforms/android-35, and build-tools are present → use stable
  2. If user explicitly wants Android 16 / newest APIs and the environment supports it → use latest
  3. If JDK is 11-16 → use legacy
  4. If the environment is incomplete → stop and surface what is missing before claiming the project is build-ready

Native 触发策略(native_enabled):

  • 默认 native_enabled = false
  • 如果提示词命中强信号(如 JNINDKCMakeexternalNativeBuildC++native library原生模块)→ 自动切到 native_enabled = true
  • 如果只命中弱信号(如 native底层性能优化)→ 先标记候选并二次确认,再决定是否开启
  • 若用户显式指定(例如 native_enabled=true/false),显式配置优先于关键词推断

Additional JDK rules:

  • Prefer a clearly configured JAVA_HOME over an accidental PATH java
  • If JAVA_HOME and PATH java disagree, treat that as a reproducibility risk and explain it
  • Prefer a project-level Gradle JDK setting for long-term consistency

Phase 3: Generate Project Structure

Always create the complete file structure: \r

ProjectName/\r
├── settings.gradle.kts\r
├── build.gradle.kts\r
├── gradle.properties\r
├── gradle/\r
│   └── wrapper/\r
│       └── gradle-wrapper.properties\r
├── gradlew\r
├── gradlew.bat\r
├── app/\r
│   ├── build.gradle.kts\r
│   ├── src/\r
│   │   └── main/\r
│   │       ├── AndroidManifest.xml\r
│   │       ├── java/com/example/project/\r
│   │       │   └── MainActivity.kt\r
│   │       └── res/\r
│   │           ├── layout/\r
│   │           │   └── activity_main.xml\r
│   │           ├── values/\r
│   │           │   ├── strings.xml\r
│   │           │   └── themes.xml\r
│   │           └── mipmap-*/\r
│   │               ├── ic_launcher.png\r
│   │               └── ic_launcher_round.png\r
│   └── proguard-rules.pro\r
└── local.properties (create when sdk path is known and immediate CLI build is expected)

Important:

  • Do not stop at "mostly complete"
  • The generated project is not considered ready until wrapper files and validation are in place
  • If SDK path is known and the goal is immediate command-line build, create local.properties with sdk.dir=... to reduce local environment ambiguity
  • If the machine has JDK 17 but no stable project-level JDK selection, recommend GRADLE_LOCAL_JAVA_HOME or equivalent project-scoped JDK binding

Phase 4: Use Configuration Templates

Load templates from references/config-templates.md: \r

  • Use the "Golden Configuration: Stable" section for the "stable" profile
  • Use the "China Mirror" variant for users in China (detected by locale or explicit request)
  • Replace placeholders: MyApp, com.example.myapp, com.example.myapp.MainActivity
  • Keep namespace, applicationId, source package path, and theme names aligned
  • If generating a project that must build immediately, prefer the template path that includes local.properties

Phase 5: Make Gradle Wrapper Real, Not Placeholder

Before reporting the project as buildable, ensure the wrapper is genuinely usable:

  • Required files:
    • gradlew
    • gradlew.bat
    • gradle/wrapper/gradle-wrapper.properties
    • gradle/wrapper/gradle-wrapper.jar
  • A gradle-wrapper.properties file alone is not enough
  • Placeholder scripts are not acceptable for a claimed "first build succeeds" result

Use one of these approaches:

  1. Copy wrapper files from a known-good template project
  2. Generate them with gradle wrapper --gradle-version \x3Ctarget-version> if Gradle is installed
  3. If neither is possible, explicitly say wrapper generation is incomplete and do not claim the project is ready for assembleDebug

You can use scripts/project_validator.py logic as the acceptance bar:

  • invalid package name => block
  • missing wrapper jar => block
  • placeholder wrapper scripts => block

Phase 6: Validate Compilation with a Real Build Loop

After generating all files, MUST run:

./gradlew assembleDebug

If compilation fails:

  1. Read the error message carefully
  2. Check version compatibility in references/version-matrix.md
  3. Check whether the failure is really caused by environment readiness, wrapper incompleteness, or template/config mismatch
  4. Fix one root cause at a time and retry
  5. Do not report success until assembleDebug passes with the generated project

If the wrapper is unavailable or the environment is missing mandatory SDK components:

  • Do not present the project as "verified buildable"
  • Say exactly which prerequisite prevented real verification

Phase 7: Confirm APK Output and Runtime Readiness

After assembleDebug, verify that the debug APK really exists:

app/build/outputs/apk/debug/app-debug.apk

Use scripts/build_flow.py concepts as the final status model:

  • scaffolding_only
    • Files were generated
    • Build was not attempted because the environment was blocked
  • build_failed
    • Gradle ran, but assembleDebug failed or no APK was produced
  • compiled
    • assembleDebug succeeded and the debug APK exists

If a device or emulator is available, continue one more step:

  • install the debug APK
  • launch the main activity
  • only then classify the project as runnable

Additional final states:

  • install_failed
    • APK exists
    • installation to device/emulator failed
  • launch_failed
    • APK installed
    • main activity launch failed
  • runnable
    • APK built
    • APK installed
    • main activity launched successfully

Only the compiled state should be described as:

  • environment normal
  • project buildable
  • APK produced

Only the runnable state should be described as:

  • environment normal
  • project buildable
  • app installable
  • app launch verified on device or emulator \r

Reference Files\r

\r

Version Compatibility Matrix\r

\r See references/version-matrix.md for:\r

  • AGP 9.x / 8.x / 7.x version requirements\r
  • Kotlin compatibility with AGP\r
  • Gradle Wrapper configuration\r \r Key rules:\r
  • AGP 8.0+ requires JDK 17 (non-negotiable)\r
  • AGP 9.x requires Gradle 9.1+\r
  • Always check the matrix when in doubt\r \r

Configuration Templates\r

\r See references/config-templates.md for:\r

  • Complete settings.gradle.kts template\r
  • Project-level and module-level build.gradle.kts\r
  • gradle.properties defaults\r
  • gradle-wrapper.properties format\r
  • Minimal MainActivity.kt and AndroidManifest.xml\r
  • China mirror configuration\r \r

Environment Detection Script\r

\r scripts/detect_env.py provides:\r \r

  • JDK version detection (parses java -version output)\r
  • Android SDK path discovery (ANDROID_HOME, ANDROID_SDK_ROOT, common paths)\r
  • Build-tools version listing\r
  • NDK version detection\r
  • Recommended configuration based on detected JDK\r \r Run this script to adapt the generated project to the user's actual environment.\r \r

Critical Rules\r

\r

  1. Never skip the validation step — Always run ./gradlew assembleDebug
  2. JDK 17 is mandatory for AGP 8.x+ — Do not generate AGP 8.x config if JDK \x3C 17
  3. Use Kotlin DSL (.kts) — Groovy DSL is legacy, prefer build.gradle.kts
  4. Set correct namespace — AGP 8.0+ requires namespace in build.gradle, not manifest
  5. A real wrapper is mandatory for build claims — Do not rely on placeholder scripts
  6. Create local.properties when immediate local CLI build is required and sdk path is known
  7. Prefer explicit JDK selection — Align JAVA_HOME, Android Studio Gradle JDK, and project-level Gradle JDK settings
  8. Use Java toolchains — Declare the required Java toolchain instead of relying only on machine defaults
  9. Use Version Catalog for complex projects — Consider gradle/libs.versions.toml for larger projects \r

Common Mistakes to Avoid\r

\r | Mistake | Fix |\r |---------|-----|\r | Missing namespace in app/build.gradle.kts | Add namespace = "com.example.myapp" in android {} block |\r | Wrong JDK version for AGP 8.x | Use AGP 7.x if JDK \x3C 17, or instruct user to install JDK 17 | | Inconsistent AGP/Gradle versions | Check version-matrix.md, use recommended pairs | | Missing or fake Gradle Wrapper files | Always include gradlew, gradlew.bat, gradle-wrapper.properties, and gradle-wrapper.jar | | Wrong compileSdk for AGP version | AGP 8.7+ requires compileSdk = 35, AGP 9.x requires compileSdk = 36 | | Missing SDK platform or build-tools | Check environment audit before generation; install missing SDK components first | | Build verified only in theory | Do not claim success without a real assembleDebug run | | JAVA_HOME missing but PATH java exists | Treat as degraded, not fully stable; recommend explicit JDK configuration | | JAVA_HOME and PATH java point to different JDKs | Explain that Gradle CLI will prefer JAVA_HOME, which can differ from shell expectations | | assembleDebug succeeded but no APK found | Treat as build verification failure until app-debug.apk is confirmed | | APK exists but install fails | Treat as install_failed; do not claim the app is runnable | | Install succeeds but launch fails | Treat as launch_failed; do not claim runtime verification passed | \r

Example Usage\r

\r User: "Create a new Android project called TodoApp"\r \r AI Response:\r \r

  1. Load this skill\r
  2. Run detect_env.py (if possible)
  3. Check the environment assessment and confirm it is ready for a stable build
  4. Select "stable" profile (AGP 8.7.0, Gradle 8.9)
  5. Generate complete project structure from templates
  6. Replace placeholders: MyAppTodoApp, com.example.myappcom.example.todoapp
  7. Ensure real wrapper files exist, not placeholders
  8. Run ./gradlew assembleDebug
  9. Confirm app/build/outputs/apk/debug/app-debug.apk exists
  10. If a device or emulator is available, install the APK and launch the main activity
  11. Report compiled only if build + APK verification pass
  12. Report runnable only if build + install + launch all pass

This skill transforms Android project generation from a guessing game into an audited, verifiable build process.

Usage Guidance
This skill appears to do what it says: generate Android projects and verify they build on the local machine. Before installing/using it: - Be prepared for local command execution: the scripts will call java, gradle/gradlew, and optionally adb. Only run this on machines where you allow such operations. - Ensure your Android toolchain is present (JAVA_HOME, Android SDK/NDK, gradle or a real Gradle wrapper). The SKILL.md warns about these, but the package metadata did not list required binaries — double-check your environment. - The skill will download Gradle/artifacts as part of real builds (normal for Android); if you want to avoid network or device interactions, run the skill in an isolated container/CI worker or with environment variables/tools stubbed. - Review the scripts if you are concerned: they are plain Python, call subprocesses, and explicitly implement adb install/launch and gradle assembly. They also create placeholder gradlew scripts in test scaffolding — the validator flags placeholder wrappers as an issue; prefer projects with a real gradle-wrapper.jar and scripts submitted to VCS. If you want, run the detection script (python scripts/detect_env.py) first to see exactly what the skill will detect and which actions it will attempt.
Capability Analysis
Type: OpenClaw Skill Name: android-project-generator Version: 1.3.0 The bundle is a comprehensive and well-documented tool for generating and validating Android projects. It includes scripts for environment auditing (detect_env.py), project structure generation, and build orchestration (build_flow.py) using Gradle and ADB. While the skill performs high-risk operations such as local command execution, network access for dependencies, and device interaction, these are essential to its stated purpose and are managed through explicit safety requirements and a multi-phase validation workflow. The inclusion of a full test suite and clear version compatibility matrices further indicates legitimate developer tooling rather than malicious intent.
Capability Assessment
Purpose & Capability
The name/description (generate build-ready Android projects, optional JNI/NDK support, validate assembleDebug) matches the included scripts (environment detection, project scaffolding, build orchestration, adb install/launch, and tests). Minor inconsistency: registry metadata lists no required binaries while SKILL.md and scripts assume local tooling (python, java, gradle/gradlew, Android SDK/NDK, adb) — this is expected for operation but the metadata omission could mislead less-technical users.
Instruction Scope
SKILL.md and the bundled scripts explicitly instruct the agent to audit the local environment (detect_env.py), create project files, run Gradle wrapper builds, verify APK output, and optionally install/launch on connected devices with adb. These actions are within the declared purpose and the README/SKILL.md warn about required tooling, device interactions, and network access for dependency resolution.
Install Mechanism
No install spec is provided (instruction-only from platform perspective). The package includes Python helper scripts and tests but does not download arbitrary remote installers or execute remote-sourced archives. Build/test operations will trigger standard Gradle/Gradle-wrapper network downloads if used, which is expected for Android builds.
Credentials
The skill does not request cloud credentials or tokens. It reads/relies on local environment variables (JAVA_HOME, ANDROID_HOME/ANDROID_SDK_ROOT, ANDROID_NDK_HOME/NDK_HOME) and binaries (java, gradle/gradlew, adb) appropriate to its function. No unrelated secrets or external service credentials are requested.
Persistence & Privilege
The skill is not always-enabled and does not request elevated platform privileges. It does run local commands and may invoke adb against attached devices, but SKILL.md documents these behaviors. It does not modify other skills or global agent configuration.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install android-project-generator
  3. After installation, invoke the skill by name or use /android-project-generator
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.3.0
- Added multilingual descriptions: now includes `description_en` (English) and `description_zh` (Chinese). - Improved discoverability and clarity for both English and Chinese-speaking users. - No changes to the underlying workflow or functionality—documentation update only.
v1.2.0
**Version 1.2.0 Summary:** Major update with new documentation, scripts, and a comprehensive testing framework. - Added extensive documentation: `README.md`, usage guides, reporting, and config/version references. - Introduced scripts for environment detection, build flow, validation, report generation, and running tests. - Implemented test suite with unit, integration, and end-to-end coverage, plus test requirements and configuration. - Updated SKILL.md description and metadata for improved clarity and accuracy.
v1.1.0
android-project-generator 1.1.0 - Major cleanup: removed 23 supporting, reference, script, and test files for a slimmer package. - SKILL.md updated with new runtime, safety, and credentials sections, clarifying operational requirements and local environment expectations. - Now explicitly documents local command execution, required environment variables, and expected binaries. - Removed embedded config/template/reference/test documentation in favor of concise and operational guidance. - Version metadata and OS/binary requirements are now included directly in the SKILL.md file.
v1.0.0
- Initial release of android-project-generator skill focused on generating Android projects that compile successfully on the first build. - Supports full environment auditing to prevent common build failures due to JDK, AGP, or Android SDK incompatibilities. - Guides users through profile selection (stable, latest, legacy) based on detected system environment, including handling for native (JNI/NDK/CMake) projects. - Ensures complete project scaffolding, including all Gradle wrapper files and configurations for immediate build readiness. - Provides clear feedback and troubleshooting if the environment is incomplete or misconfigured.
Metadata
Slug android-project-generator
Version 1.3.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 4
Frequently Asked Questions

What is Android Project Generator?

Generate Android projects that compile on the first real build, including optional JNI/NDK/CMake native setup. Use when creating new Android apps, configurin... It is an AI Agent Skill for Claude Code / OpenClaw, with 109 downloads so far.

How do I install Android Project Generator?

Run "/install android-project-generator" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Android Project Generator free?

Yes, Android Project Generator is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Android Project Generator support?

Android Project Generator is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Android Project Generator?

It is built and maintained by oahc09 (@oahc09); the current version is v1.3.0.

💬 Comments