In the DeepSeek Harness (DSH) ecosystem, developers often need agents to handle specific build tasks. Local environment configuration is cumbersome, and different projects have varying dependency versions, easily leading to the “works on my machine” problem. This plugin solves the problem of “directly building an Android project folder into an APK in any DSH session.” It is maintained by memories-coder and is licensed under the MIT license.
Core Features¶
The plugin primarily provides the following capabilities:
- Project Detection: Automatically detects Gradle Android projects, supports
settings.gradle,settings.gradle.kts, andbuild.gradle, and optionally supports the Gradle Wrapper. - Toolchain Downloading: Automatically prepares the toolchain required for building. It prioritizes system environment variables (
JAVA_HOME,ANDROID_HOME, etc.); otherwise, it automatically downloads Temurin JDK (default 17), Android cmdline-tools, platform-tools, build-tools, and platform into the.android-buildfolder under the session working directory, without polluting the user directory. - Build and Output: Runs
assemble<Variant>(defaultdebug, supportsrelease) to build artifacts, and copies the APK to the specified output folder. - Non-ASCII Path Handling: When the project path contains non-ASCII characters (such as Chinese), the plugin automatically stages the project and SDK into an ASCII temporary directory for building, and copies the APK back to the original output folder after the build is complete, requiring no manual handling.
- Cache Mechanism: All downloaded toolchains, Gradle distributions, and dependency caches (
GRADLE_USER_HOME) are stored in the download folder, can be reused, and reduce repetitive downloads.
Installation¶
Installing this plugin requires that pnpm is installed in the DSH environment and available in PATH.
Method 1: Use a DSH natural language command
The simplest way is to issue the following command directly to DSH:
帮我安装这个DSH插件:https://github.com/memories-coder/DSH-plugin-android-apk.git
Method 2: Manual installation
Run the following command on the DSH host machine (replace <plugin path> with the actual path):
dsh plugin --profile web add "<插件路径>/DSH-plugin-android-apk-main"
Note:
dsh pluginactually runspnpm add <spec>in the profile directory, then adds packages that declaredsh.bundle.patchtodsh.profile.bundles.
Caution: After installation, DSH must be restarted for the changes to take effect.
Usage¶
After installation, you can use it through natural language commands or by explicitly calling the tool function.
Natural language command:
Tell DSH directly:
把 `xxx` 文件夹构建成 APK
Explicit tool call:
build_android_apk(project="myapp", variant="debug", clean=false)
Parameter description:
| Parameter | Description | Default |
|---|---|---|
project |
Path to the Android project folder (relative paths are based on the session working directory) | Required |
variant |
Gradle variant (debug / release) | debug |
clean |
Whether to run clean first for a full rebuild | false |
downloadDir |
Toolchain download directory | <workspace>/.android-build |
apkOutputDir |
APK copy destination directory | <workspace>/apk |
gradleVersion |
Gradle version downloaded when no available Wrapper is present | 8.9 |
compileSdk |
Overrides the auto-detected compileSdk | Auto-detected; 34 if unknown |
Configuration and Notes¶
The plugin supports global configuration via config in cordis.patch.yml. For example:
config:
defaultVariant: debug
jdkMajor: 17
gradleVersion: "8.9"
Notes:
1. Network Dependency: Gradle dependencies (AGP, AndroidX) are fetched from dl.google.com; network restrictions may cause timeouts. The plugin automatically attempts a mirror fallback, but configuring a proxy is recommended to ensure speed.
2. JDK Version: JDK 17 is used by default. If the project requires JDK 8 or 11, modify jdkMajor in config or set JAVA_HOME in advance.
3. pnpm Requirement: The dsh plugin command depends on pnpm.
4. Non-Windows Support: The plugin also supports non-Windows hosts (via gradlew/gradle scripts + tar extraction).
5. Troubleshooting Build Failures: If a build fails, check whether pnpm is available and confirm that DSH has been restarted after installation.