Token导航 LogoToken导航

Agent Skill · 研究检索

build-android(构建安卓)

build-android 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

build-android 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 48,806。

总安装 675周安装 29GitHub Stars 239下载 237核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:build-android(构建安卓)
来源仓库:https://github.com/sharex/xerahs
仓库路径:skills/build-android
安装命令:
npx skills add https://github.com/sharex/xerahs --skill build-android
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/sharex/xerahs --skill build-android

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

build-android 用于 Android 应用构建与部署的专业支持,适用于 Kotlin/Maui 和 Avalonia 项目。它包含构建守卫机制、设备/模拟器管理及 APK 输出路径控制,确保流程高效可靠。使用时需遵循共享构建规则,并在超时时主动终止异常进程,防止卡死或重复操作。

安装前请确认仓库权限、维护状态,以及是否会触发 adb 命令或安装 SDK 组件。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/build-android

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/sharex/xerahs --skill build-android;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

build-android 怎么安装?

在终端执行 npx skills add https://github.com/sharex/xerahs --skill build-android。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

build-android 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

build-android 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/sharex/xerahs --skill build-android 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

build-android 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

build-android 用的人多吗?

公开数据是累计安装 675 次,近一周安装 29 次,下载 237 次,GitHub 239 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

build-android 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
build-android

构建安卓 · 本页

675239执行命令未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

You are an expert Android build and deploy specialist for XerahS mobile (Kotlin/Mobile.Kt, Avalonia, and MAUI).

Follow these instructions when building or deploying Android apps. Never let a build wait more than 5 minutes without concluding something is wrong (locks, stuck process, or wrong command).

Shared Build Guardrails

Before Android-specific work, follow build-common for shared timeout, lock recovery, no-concurrent-build, -m:1, TFM, and SkiaSharp rules. This Android skill owns Android-specific prerequisites, emulator/device handling, APK output paths, and deploy commands.

5-minute build rule (critical)

Do not wait more than 5 minutes for an Android build to complete. A normal single-node Android build finishes in about 2–5 minutes. If the build has not completed within 5 minutes:

  1. Treat it as a failure — something else is wrong.
  2. Stop the build (cancel or let the command timeout).
  3. Fix the cause before retrying:

- Lingering processes: A previous dotnet build may be holding the APK or DLLs. Find and stop the process (see "Pre-build: release locks" below). - Clean failing: If dotnet clean fails with "file in use", the lock is often the APK or a DLL; the error message names the process (e.g. ".NET Host (PID)"). - Parallelism: Use -m:1 so only one project builds at a time and ShareX.ImageEditor/plugin DLLs are not raced.

Do not increase the timeout to 10+ minutes. Fix locks and parallelism instead.


Kotlin (src/mobile/android): prerequisites and first-build lessons

The Kotlin app uses Gradle (not dotnet). The project root is src/mobile/android (where settings.gradle.kts and gradlew.bat live).

1. JAVA_HOME is required

First build often fails with: JAVA_HOME is not set and no 'java' command could be found in your PATH.

  • Gradle needs a JDK. On Windows, adb and java are often not in PATH; the IDE uses the embedded JBR.
  • Fix: Set JAVA_HOME to the JDK used by Android Studio before running Gradle, then run the build in the same process (e.g. one PowerShell command that sets env and invokes gradlew):
$env:JAVA_HOME = "C:\Program Files\Android\Android Studio\jbr"
cd "src\mobile\android"
.\gradlew.bat assembleDebug
  • If the repo is under a path with spaces (e.g. ShareX Team\XerahS), use quoted paths and ensure cd is to the Kotlin project root.

2. Compose KeyboardOptions: correct import and dependency

Symptom: Unresolved reference: KeyboardOptions when compiling a module that uses KeyboardOptions in a Compose TextField/OutlinedTextField.

  • Wrong: import androidx.compose.ui.text.input.KeyboardOptions — that package does not expose KeyboardOptions in the way the compiler resolves for the dependency set in use.
  • Right: import androidx.compose.foundation.text.KeyboardOptions. KeyboardCapitalization stays androidx.compose.ui.text.input.KeyboardCapitalization; KeyboardType is androidx.compose.ui.text.input.KeyboardType.
  • Module dependency: The module that uses KeyboardOptions (e.g. feature:settings) must depend on Compose Foundation, or the build will still fail with "Unresolved reference: KeyboardOptions". In that module’s build.gradle.kts:
implementation(libs.compose.foundation)
  • URL / no auto-capitalize: For URL or domain fields, use KeyboardType.Uri together with KeyboardCapitalization.None so the soft keyboard does not auto-capitalize; some IMEs ignore capitalization when the type is already Uri.

3. adb not in PATH

Symptom: The term 'adb' is not recognized when running install or logcat from a script or terminal.

  • Use the full path to adb, e.g. $env:LOCALAPPDATA\Android\Sdk\platform-tools\adb.exe, or set ANDROID_HOME / PATH so that adb is found. The build skill assumes adb is invoked via full path when PATH is not configured.

4. Kotlin build and deploy (summary)

StepCommand / path
Project rootsrc\mobile\android
BuildSet JAVA_HOME then .\gradlew.bat assembleDebug
APKapp\build\outputs\apk\debug\app-debug.apk
Installadb install -r <path-to-app-debug.apk>

Pre-build: release locks

File locks are the main cause of Android build failures. Before building, ensure no previous build is still running and clean can run.

1. Identify what is locked

  • Clean fails with The process cannot access the file '...' because it is being used by another process. The message often says which process (e.g. .NET Host (27788) or VBCSCompiler).
  • Build fails with CompileAvaloniaXamlTask / Cannot open '...ShareX.ImageEditor.dll' for writing or ...XerahS.AmazonS3.Plugin.dll... being used by another process — usually parallel MSBuild racing on the same output.
  • Build fails with XA0142 / llvm-objcopy.EXE: error: permission denied or `XAWAS7024: The file is locked by: ".NET Host (PID)" on paths likeobj\Debug\net10.0-android\android-arm64\wrapped\lib_*.dll.so — a previous build’s.NET Host is still holding wrapped assembly outputs. Stop that PID, then clean and rebuild.

2. Stop the process holding the lock

If the error names a PID (e.g. 27788):

Stop-Process -Id 27788 -Force -ErrorAction SilentlyContinue
Start-Sleep -Seconds 2

If you see many dotnet processes and a recent build was run, consider stopping only the ones that are build workers (e.g. those that have been running for a long time). Avoid killing the IDE’s dotnet (e.g. OmniSharp) if possible; closing other terminals/builds first is safer.

3. Use single-node build to avoid races (required)

NEVER run two Android (or solution) builds at the same time. ShareX.ImageEditor and the AmazonS3 plugin share outputs that the Avalonia XAML task and MSBuild copy; parallel MSBuild nodes race on the same DLLs and Android wrapped .so files and cause lock errors. That is why the Android build feels slow: we must use -m:1 (single node), so the build runs sequentially with no parallelism.

  • MAUI: The script build-and-deploy-android-maui.ps1 already uses -m:1. Do not remove it.
  • Avalonia: The script build-and-deploy-android-ava.ps1 uses -m:1 by default. Do not remove it.

Example:

dotnet build $projectPath -f net10.0-android -c Debug -m:1

4. Clean after releasing locks

After stopping the locking process:

dotnet clean "src\mobile-experimental\XerahS.Mobile.Maui\XerahS.Mobile.Maui.csproj" -f net10.0-android -c Debug -v minimal
# For Avalonia:
dotnet clean "src\mobile-experimental\XerahS.Mobile.Ava\XerahS.Mobile.Ava.csproj" -f net10.0-android -c Debug -v minimal

If clean still fails, manually remove obj folders that are locked (e.g. ShareX.ImageEditor\src\ShareX.ImageEditor\obj, src\desktop\plugins\AmazonS3.Plugin\obj, src\mobile-experimental\XerahS.Mobile.Ava\obj\Debug\net10.0-android, or the MAUI obj\Debug\net10.0-android if the APK is locked).


Cold-boot emulator (optional)

To start an Android emulator with a cold boot (no snapshot load) before building/deploying:

  1. List AVDs: & "$env:LOCALAPPDATA\Android\Sdk\emulator\emulator.exe" -list-avds
  2. Start emulator: Start-Process -FilePath $emulator -ArgumentList "-avd","<AVD_NAME>","-no-snapshot-load" -WindowStyle Normal
  3. Wait for device: Poll until adb devices shows a line ending with device (e.g. up to 120 s). The build script will fail with "No emulator/device attached" if no device is present when it runs the install step.
  4. Then run the build-and-deploy script. If the emulator is closed or disconnects during the 2–5 minute build, run adb devices again and restart the emulator if needed before re-running only the deploy (manual install/launch below).

MAUI-specific: EmbedAssembliesIntoApk

When the MAUI app is installed via adb install (not via Visual Studio deploy), the APK must contain the.NET assemblies. By default, Debug uses Fast Deployment, which omits assemblies from the APK and pushes them via the IDE; so a standalone adb install -r results in "No assemblies found" and the app crashes after the splash.

  • Fix: In XerahS.Mobile.Maui.csproj, set EmbedAssembliesIntoApk to true for Android (already done). Then rebuild; the APK will be larger and work with adb install.
  • Trade-off: Build is slightly slower; no change to behavior once embedded.

MAUI white screen / init

If the MAUI app shows a white screen after the logo (similar to the old Avalonia "stuck" issue):

  • Cause: The loading page has not painted before heavy init runs (or with EmbedAssembliesIntoApk, first frame is slower). Starting init too soon leaves the user seeing a blank screen.
  • Fix: In MainActivity.cs, defer calling InitializeCoreAsync by ~400 ms (e.g. Task.Run + Task.Delay(400) + MainThread.BeginInvokeOnMainThread). Do not call it immediately in OnCreate. See developers/lessons-learnt/android_avalonia_init_fix.md (MAUI section).

Avalonia-specific: host Content

Avalonia Android had a bug where parent.Content = null in MainActivity cleared the host of MainView, so the whole UI disappeared even though init and navigation completed. Do not set the host’s Content to null. See developers/lessons-learnt/android_avalonia_init_fix.md.


Build and deploy commands

Kotlin (src/mobile/android)

Set JAVA_HOME and build from the Kotlin project root (see "Kotlin: prerequisites and first-build lessons" above). Then install with adb (full path if adb is not in PATH).

$env:JAVA_HOME = "C:\Program Files\Android\Android Studio\jbr"
cd "src\mobile\android"   # or full path, e.g. C:\...\XerahS\src\mobile\android
.\gradlew.bat assembleDebug

Install and optionally launch:

$adb = "$env:LOCALAPPDATA\Android\Sdk\platform-tools\adb.exe"
& $adb install -r "src\mobile\android\app\build\outputs\apk\debug\app-debug.apk"
& $adb shell monkey -p com.getsharex.xerahs.mobile -c android.intent.category.LAUNCHER 1

If the first build fails with JAVA_HOME or KeyboardOptions, apply the fixes in the Kotlin section above before retrying.

MAUI (recommended: use script)

.\build\android\build-and-deploy-android-maui.ps1
# If you need a clean first (e.g. after fixing locks):
.\build\android\build-and-deploy-android-maui.ps1 -Clean
  • Script uses -m:1 and runs clean (if -Clean), build, then adb install and launch.
  • Timeout: Run with a 5-minute cap. If the build does not finish in 5 minutes, stop and fix locks/processes.

Avalonia

.\build\android\build-and-deploy-android-ava.ps1
.\build\android\build-and-deploy-android-ava.ps1 -Clean

The Avalonia script always uses -m:1 to avoid file locks. Ensure an emulator or device is attached (adb devices) before running; the script checks for a device only at deploy time, so if the emulator was closed during the build, start it again and run manual install/launch below.

Manual install and launch (when APK already exists)

Use when the APK is already built but deploy failed (e.g. no device at script run time), or to re-launch without rebuilding. Set $adb from ANDROID_HOME or %LOCALAPPDATA%\Android\Sdk if needed.

MAUI:

$adb = "$env:LOCALAPPDATA\Android\Sdk\platform-tools\adb.exe"
& $adb install -r "src\mobile-experimental\XerahS.Mobile.Maui\bin\Debug\net10.0-android\com.getsharex.xerahs-Signed.apk"
& $adb shell monkey -p com.getsharex.xerahs -c android.intent.category.LAUNCHER 1

Avalonia:

$apk = (Get-ChildItem "src\mobile-experimental\XerahS.Mobile.Ava\bin\Debug\net10.0-android\*.apk" | Select-Object -First 1).FullName
& $adb install -r $apk
& $adb shell monkey -p com.getsharex.xerahs -c android.intent.category.LAUNCHER 1

Success criteria

  • Build completes in under 5 minutes (typically 2–3 min with -m:1 and no locks for.NET; Kotlin Gradle builds often 1–2 min once JAVA_HOME is set).
  • No "file in use", XA0142/XAWAS7024, or CompileAvaloniaXamlTask copy errors.
  • A device or emulator is present when the script runs the install step (adb devices); otherwise use manual install/launch after starting the emulator.
  • Kotlin: JAVA_HOME set; no "Unresolved reference: KeyboardOptions" (use foundation.text.KeyboardOptions and add compose.foundation to the module); APK installs via adb install -r and app runs.
  • MAUI: APK installs via adb install -r and app runs past the loading screen (no white screen, no "No assemblies found" crash).
  • Avalonia: APK installs and app shows loading then main UI (no blank screen from host Content cleared).

References

  • .ai/skills/build-common/SKILL.md - Shared timeout, lock recovery, no-concurrent-build, -m:1, TFM, and SkiaSharp guardrails
  • developers/lessons-learnt/android_avalonia_init_fix.md — Avalonia host-Content bug, MAUI defer-init and white screen
  • build/android/README.md — Prerequisites, env (JAVA_HOME, Android SDK)
  • build/android/build-and-deploy-android-maui.ps1 — MAUI build/deploy script (uses -m:1)
  • build/android/build-and-deploy-android-ava.ps1 — Avalonia build/deploy script (uses -m:1)
  • .ai/skills/build-android/SKILL.md — This skill; Kotlin JAVA_HOME, Compose KeyboardOptions/foundation, adb path

平台分布

Codex

36.11%
按下载量换算86

Claude

31.81%
按下载量换算75

Cursor

16.77%
按下载量换算40

Gemini CLI

8.69%
按下载量换算21

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/sharex/xerahs --skill build-android 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills