Xpersona
A

android-project-generator

CLAWHUB · Unverified

Generate Android projects that compile on the first real build, including optional JNI/NDK/CMake native setup. Use when creating new Android apps, configuring Gradle and version compatibility, validating assembleDebug readiness, or adding native modules. Skill: android-project-generator Owner: oahc09 Summary: Generate Android projects that compile on the first real build, including optional JNI/NDK/CMake native setup. Use when creating new Android apps, configuring Gradle and version compatibility, validating assembleDebug readiness, or adding native modules. Tags: latest:1.3.1 Version history: v1.3.1 | 2026-10-03T05:03:37.532Z | user **Test harness and packaging bou

62
Rank
84
Safety
989
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 989 downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s172dx5h7s0zddwzakbc1r3ysx83gjxg:android-project-generator
  1. Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-oahc09-android-project-generator/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

147,849 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: 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, configuring Gradle and version compatibility, validating assembleDebug readiness, or adding native modules.
description_en: Generate Android projects that compile on the first real build, including optional JNI/NDK/CMake native setup. Use when creating new Android apps, configuring Gradle and version compatibility, validating assembleDebug readiness, or adding native modules.
description_zh: 生成以首次真实构建通过为目标的 Android 工程,并支持可选的 JNI/NDK/CMake Native 集成。当你需要创建新 Android 应用、配置 Gradle 与版本兼容性、验证 assembleDebug 可构建性,或接入 Native 模块时使用此技能。
license: MIT
metadata:
  author: oahcfly
  version: 1.3.1
  category: mobile
---

# Android Project Generator Skill

## Purpose

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

1. **Version compatibility knowledge** — AGP/Gradle/JDK/Kotlin version matrices
2. **Standardized configuration templates** — Complete, working Gradle configurations
3. **Environment detection** — Adapt to local JDK/SDK versions
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

## Runtime & Safety Requirements

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

- Required binaries are present in PATH: `python`, `java`, and at least one of `gradle`/`gradlew`.
- 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.
- Environment variables are correctly scoped: `JAVA_HOME` (recommended), `ANDROID_HOME` or `ANDROID_SDK_ROOT`, optional `ANDROID_NDK_HOME` or `NDK_HOME` for native workflows.
- Local command execution is acceptable in the current host policy.
- Device interactions (`adb install`, `adb shell am start`) are allowed for connected devices/emulators.
- Build-time network access is acceptable (for Gradle wrapper/dependency resolution).

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.

## Credentials

This skill does not require cloud credentials, API keys, or tokens.

It does rely on local environment variables and installed binaries/tooling:

- Env vars inspected/used: `JAVA_HOME`, `ANDROID_HOME`/`ANDROID_SDK_ROOT`, and for native projects `ANDROID_NDK_HOME`/`NDK_HOME`.
- Binaries/tooling expected: `java`, `gradle`/`gradlew`, Android SDK/NDK on disk, and optional `adb` for install/launch verification.

The scripts do not intentionally exfiltrate data, but they do run subprocesses that may:

README.md

# android-project-generator
When generating an Android project from scratch, it can be compiled successfully in one go.

## Python Environment

- Python 3.10+ recommended
- Install test dependencies before running scripts that call pytest:

```bash
python -m pip install -r tests/requirements.txt
```

## Directory Layout

```text
android-project-generator/
├── SKILL.md                    # skill entrypoint
├── README.md
├── LICENSE
├── references/                 # version matrix and config templates
├── scripts/                    # skill runtime helpers (shipped)
│   ├── detect_env.py           # environment audit
│   ├── project_validator.py    # project readiness acceptance bar
│   └── build_flow.py           # assembleDebug / adb orchestration
├── tests/                      # dev-only self-test harness (NOT shipped)
│   ├── run_tests.py            # test runner entrypoint
│   ├── generate_report.py      # report generator
│   ├── report_generator.py     # HTML report renderer
│   ├── sitecustomize.py        # keeps pycache/tmp inside cache/
│   ├── REPORTING.md            # how to generate and view reports
│   ├── unit/ integration/ e2e/ # test suites
│   └── requirements.txt
├── cache/                      # python / pytest / coverage caches (ignored)
└── reports/                    # generated reports (ignored)
```

## Release Scope

The published skill package ships **only the skill runtime**:

```text
SKILL.md  README.md  LICENSE  references/  scripts/
```

`tests/`, `cache/`, and `reports/` are development-only and must not be
included in a release. `.skillignore` at the repository root declares this
exclusion set; packaging tools that honour ignore files pick it up
automatically, otherwise exclude the three directories explicitly.

Runtime code never imports from `tests/`. The skill's workflow (Phase 1-7 in
`SKILL.md`) only invokes `scripts/detect_env.py`, `references/*`, and
`scripts/build_flow.py`.

## Development

All self-test tooling lives under `tests/`:

```bash
python tests/run_tests.py              # run all tests + HTML report
python tests/run_tests.py --unit       # unit tests only
python tests/run_tests.py --open-report
python tests/run_tests.py --report-only
```

Tests never prompt for input; the report is only opened when `--open-report` is
passed explicitly, so the runner is safe for non-interactive use.

See `tests/REPORTING.md` for report details.

## Features

- AGP / Gradle / JDK / Kotlin compatibility profiles
- Local environment detection
- Complete Android project templates
- Real Gradle Wrapper validation
- `assembleDebug` build verification
- APK output confirmation
- JNI / NDK / CMake native project setup
- Build-state reporting: scaffolding_only, build_failed, compiled, runnable

## Roadmap

- Expand Android template coverage
- Add Compose template support
- Add CI matrix for AGP / Gradle / JDK combinations
- Add more JNI / NDK / CMake examples
- Improve China mirror support
- Add GitHub Action for generated p

tests/README.md

# 测试套件使用指南

## 测试结构

```
tests/
├── conftest.py                 # Pytest 共享配置
├── test-plan.md                # 测试计划文档
├── unit/                       # 单元测试
│   ├── test_detect_env.py      # 环境检测脚本测试
│   └── test_config_generation.py # 配置生成测试
├── integration/                # 集成测试
│   └── test_project_structure.py # 项目结构生成测试
└── e2e/                        # 端到端测试
    └── test_e2e_compilation.py   # 完整编译流程测试
```

## 快速开始

### 安装依赖

```bash
pip install pytest pytest-cov pytest-mock
```

### 运行测试

```bash
# 运行所有单元测试
python -m pytest tests/unit -v

# 运行集成测试
python -m pytest tests/integration -v

# 运行端到端测试(需要完整环境)
python -m pytest tests/e2e -v --runslow

# 运行所有测试
python -m pytest tests/ -v

# 只运行 P0 优先级测试
python -m pytest tests/ -v -m p0

# 跳过慢速测试
python -m pytest tests/ -v -m "not slow"

# 生成覆盖率报告
python -m pytest tests/ --cov=scripts --cov-report=html:reports/htmlcov
```

## 测试分类

### 单元测试 (Unit Tests)
- **速度**: < 1 秒
- **目的**: 验证单个函数/类的行为
- **依赖**: 无外部依赖,使用 Mock
- **文件**: `tests/unit/test_*.py`

### 集成测试 (Integration Tests)
- **速度**: 1-5 秒
- **目的**: 验证组件间协作
- **依赖**: 文件系统,临时目录
- **文件**: `tests/integration/test_*.py`

### 端到端测试 (E2E Tests)
- **速度**: 1-3 分钟
- **目的**: 验证完整流程
- **依赖**: JDK 17+, Android SDK, Gradle
- **文件**: `tests/e2e/test_*.py`
- **标记**: `@pytest.mark.slow`

## 测试标记

使用 pytest 标记分类测试:

| 标记 | 说明 | 示例 |
|------|------|------|
| `@pytest.mark.unit` | 单元测试 | 快速验证 |
| `@pytest.mark.integration` | 集成测试 | 组件协作 |
| `@pytest.mark.e2e` | 端到端测试 | 完整流程 |
| `@pytest.mark.slow` | 慢速测试 | 编译测试 |
| `@pytest.mark.p0` | 关键测试 | 核心功能 |
| `@pytest.mark.requires_jdk17` | 需要 JDK 17 | 环境依赖 |

## 测试数据

测试数据定义在 `conftest.py` 和测试文件中:

### JDK 版本输出样本
- `sample_jdk_output_jdk17`: JDK 17 输出
- `sample_jdk_output_jdk11`: JDK 11 输出
- `sample_jdk_output_jdk8`: JDK 8 输出(遗留格式)

### 配置数据
- `stable_config`: stable 配置
- `legacy_config`: legacy 配置
- `china_mirror_repos`: 国内镜像仓库

## CI/CD 集成

### GitHub Actions 示例

```yaml
name: Tests

on: [push, pull_request]

jobs:
  unit-tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.11'
      - name: Install dependencies
        run: pip install pytest pytest-cov
      - name: Run unit tests
        run: python -m pytest tests/unit -v --cov=scripts

  integration-tests:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
      - name: Run integration tests
        run: python -m pytest tests/integration -v

  e2e-tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-java@v4
        with:
          java-version: '17'
          distribution: 'temurin'
      - uses: android-actions/setup-android@v3
      - name: Run E2E tests
        run: python -m pytest tests/e2e -v --runslow
```

## 测试覆盖率目标

| 模块 | 目标覆盖率 | 当前覆盖率 |
|------|------

_meta.json

{
  "ownerId": "kn759mntake5xe2rz3cvmka7c582er3a",
  "slug": "android-project-generator",
  "version": "1.3.1",
  "publishedAt": 1791003817532
}

references/config-templates.md

# Android 项目配置模板

> 标准化的 Gradle 配置文件模板

## 项目文件结构

```
MyApp/
├── settings.gradle.kts          # 项目设置
├── build.gradle.kts             # 项目级构建配置
├── gradle.properties            # Gradle 属性
├── gradle/
│   └── wrapper/
│       └── gradle-wrapper.properties
├── gradlew                      # Unix 启动脚本
├── gradlew.bat                  # Windows 启动脚本
├── app/
│   ├── build.gradle.kts         # 模块级构建配置
│   └── src/
│       └── main/
│           ├── AndroidManifest.xml
│           ├── java/
│           └── res/
└── local.properties             # 当已知 sdk 路径且需要立即 CLI 构建时生成
```

## 黄金配置:稳定版 (AGP 8.7.0)

### settings.gradle.kts

```kotlin
pluginManagement {
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
}

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.name = "MyApp"
include(":app")
```

### build.gradle.kts (项目级)

```kotlin
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id("com.android.application") version "8.7.0" apply false
    id("org.jetbrains.kotlin.android") version "2.0.21" apply false
}
```

### app/build.gradle.kts (模块级)

```kotlin
plugins {
    id("com.android.application")
    id("org.jetbrains.kotlin.android")
}

android {
    namespace = "com.example.myapp"
    compileSdk = 35

    defaultConfig {
        applicationId = "com.example.myapp"
        minSdk = 24
        targetSdk = 35
        versionCode = 1
        versionName = "1.0"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }

kotlinOptions {
    jvmTarget = "17"
}

java {
    toolchain {
        languageVersion.set(JavaLanguageVersion.of(17))
    }
}

buildFeatures {
    viewBinding = true
}
}

dependencies {
    implementation("androidx.core:core-ktx:1.15.0")
    implementation("androidx.appcompat:appcompat:1.7.0")
    implementation("com.google.android.material:material:1.12.0")
    implementation("androidx.constraintlayout:constraintlayout:2.2.0")
    
    testImplementation("junit:junit:4.13.2")
    androidTestImplementation("androidx.test.ext:junit:1.2.1")
    androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
}
```

### gradle.properties

```properties
# Project-wide Gradle settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.caching=true

# Android settings
android.useAndroidX=true
android.nonTransitiveRClass=true
```

### gradle-wrapper.properties

```properties
distribu

Sponsored

Ads related to android-project-generator and adjacent AI workflows.