limrun-gradle
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRemote Gradle build
远程Gradle构建
Build Android projects on Limrun's remote Gradle sandboxes, from any
environment (Linux, Windows, macOS, VM, container). syncs
your sources to a remote instance, runs the project's own Gradle wrapper
there, and streams the build output. Never fall back to local Gradle, a local
Android SDK, or a local emulator. Your job doesn't end at a green build: get
the app running or the artifact delivered, and iterate until the user is
satisfied.
lim gradle buildFor iOS work, use (native) or
(Expo dev loop) instead of this skill.
limrun-xcodelimrun-expo-development在Limrun的远程Gradle沙箱中构建Android项目,支持任意环境(Linux、Windows、macOS、虚拟机、容器)。会将你的源码同步到远程实例,在那里运行项目自带的Gradle wrapper,并流式传输构建输出。无需再依赖本地Gradle、本地Android SDK或本地模拟器。你的工作不止于成功构建:要确保应用能运行或交付产物,持续迭代直至用户满意。
lim gradle buildiOS相关工作请使用**(原生项目)或**(Expo开发循环),而非本技能。
limrun-xcodelimrun-expo-developmentAuth and CLI
认证与CLI
Install if needed: . Auth is or
(it may be set outside the project, so don't ask for it just
because it's missing from or the shell). The CLI is the source of truth:
the commands in this skill are verified, but if a flag errors or you need one
not shown here, check instead of guessing:
npm install --global limlim loginLIM_API_KEY.env--helpbash
lim gradle --help
lim gradle build --help如需安装,请执行:。认证方式为或设置(该密钥可能在项目外设置,因此不要仅因或Shell中未找到就向用户索要)。CLI是权威来源:本技能中的命令均已验证,但如果某个标志报错或你需要此处未展示的标志,请查看而非猜测:
npm install --global limlim loginLIM_API_KEY.env--helpbash
lim gradle --help
lim gradle build --helpBuild an APK
构建APK
Instead of , build with:
./gradlewbash
lim gradle build .This creates or reuses the remembered Gradle instance, syncs the current
directory, and runs by default. Pick tasks explicitly with
(repeatable):
assembleDebug--taskbash
lim gradle build . --task :app:assembleReleaseUse when the Gradle root is nested and auto-discovery is
ambiguous (for example a bare React Native repo where Gradle lives in
; the server usually finds it on its own):
--project-pathandroid/bash
lim gradle build . --project-path androidExpo managed-workflow projects (no directory) are detected
automatically: the sandbox installs dependencies and runs
before Gradle. Setting (monorepos) or forces that
pipeline and errors when no Expo app is detected:
android/expo prebuild--expo-app-dir--abibash
lim gradle build ./my-monorepo --expo-app-dir apps/mobile无需使用,执行以下命令构建:
./gradlewbash
lim gradle build .此命令会创建或复用已保存的Gradle实例,同步当前目录,默认运行任务。可通过(可重复使用)显式指定任务:
assembleDebug--taskbash
lim gradle build . --task :app:assembleRelease当Gradle根目录嵌套且自动识别存在歧义时(例如裸React Native仓库中Gradle位于目录下;通常服务器可自行识别),使用:
android/--project-pathbash
lim gradle build . --project-path androidExpo托管工作流项目(无目录)会被自动检测:沙箱会先安装依赖并运行,再执行Gradle构建。设置(适用于单体仓库)或会强制启用该流程,若未检测到Expo应用则报错:
android/expo prebuild--expo-app-dir--abibash
lim gradle build ./my-monorepo --expo-app-dir apps/mobileRun it on an emulator
在模拟器上运行
Upload the built APK as a named asset, then install it on an Android instance:
bash
lim gradle build . --upload myapp.apk
lim android create --install-asset=myapp.apkIf the create output includes a signed stream URL, share it with the user as a
Markdown link, such as Live emulator. Drive the device
with commands (, , , ,
; see ). For rebuild iterations, patch the
installed APK in place instead of recreating the instance:
lim androidscreenshottaptypeelement-treerecordlim android --helpbash
lim android sync ./path/to/app-debug.apk将构建好的APK作为命名资产上传,然后安装到Android实例:
bash
lim gradle build . --upload myapp.apk
lim android create --install-asset=myapp.apk如果创建输出包含签名流URL,请将其作为Markdown链接分享给用户,例如在线模拟器。使用命令操作设备(、、、、;详见)。如需重新构建迭代,可直接替换已安装的APK,无需重新创建实例:
lim androidscreenshottaptypeelement-treerecordlim android --helpbash
lim android sync ./path/to/app-debug.apkSign a release AAB
为发布版AAB签名
The default signing path needs NO credentials from the user:
bash
lim gradle build . --sign --upload myapp.aabOn first use, Limrun generates an upload keystore, escrows it as the
organization's signing key for this app, and signs with it. Every later
build of the same app, from any machine or CI, uses the same key, so
Play Store uploads keep matching. The key is named by the Android application
ID, detected from (Expo) or ; pass
when detection fails or picks the wrong flavor.
--signapp.jsonapp/build.gradle(.kts)--application-id <id>--signbundleRelease--taskExpect one of these lines before the build starts and relay its meaning:
- : first build of this app; the key now exists for the whole organization.
Signing with the organization's upload key for <app> (newly generated). - : reusing the escrowed key, as intended.
Signing with the organization's upload key for <app> (existing).
默认签名流程无需用户提供任何凭据:
bash
lim gradle build . --sign --upload myapp.aab首次使用时,Limrun会生成一个上传密钥库,将其作为组织针对该应用的签名密钥托管,并使用它进行签名。之后,任何机器或CI环境中对同一应用执行的构建,都会使用同一个密钥,确保Play Store上传的签名一致。密钥名称由Android应用ID决定,该ID从(Expo项目)或(原生项目)中检测;若检测失败或选择了错误的变体,请传递。
--signapp.jsonapp/build.gradle(.kts)--application-id <id>--signbundleRelease--task构建启动前会出现以下其中一行信息,请向用户传达其含义:
- :该应用首次构建;密钥现已为整个组织创建。
Signing with the organization's upload key for <app> (newly generated). - :复用已托管的密钥,符合预期。
Signing with the organization's upload key for <app> (existing).
Bring your own upload key
使用自定义上传密钥
When the app already has a registered upload key (an existing Play listing),
sign with the user's keystore instead:
bash
lim gradle build . \
--keystore upload.jks --keystore-password "$KS_PASS" \
--key-alias upload --key-password "$KEY_PASS" \
--upload myapp.aabAll four flags travel together; the passwords can come from
and instead of argv. Add
to escrow the provided key so later builds can drop the flags and
use plain . refuses to overwrite: if a DIFFERENT key is
already escrowed for the app it fails before any instance is created.
LIM_KEYSTORE_PASSWORDLIM_KEY_PASSWORD--save-key--sign--save-keyCollect from the user:
- the keystore file path (or
.jks); never commit it or paste its bytes into files,.p12 - the keystore password and the key password (often the same value),
- the key alias (shows it if unknown).
keytool -list -keystore <file>
Failure strings to recognize on the bring-your-own path:
- :
The organization already has a different upload key escrowed for <app>conflict. Builds with--save-keyuse the escrowed key; drop--signto sign with the provided keystore for this build only, or ask the user which key is the real upload key.--save-key - : the BYO flag group is incomplete; the message lists exactly the missing flags.
Signing with your own key requires ... as well - : the password or alias has characters outside ISO-8859-1. Change it in place with keytool (
signing <field> contains an unsupported character,-storepasswd, or-keypasswd) to a Latin-1 value. Never regenerate the key itself: that changes the upload key.-changealias
若应用已有注册的上传密钥(已存在Play商店列表),请使用用户的密钥库进行签名:
bash
lim gradle build . \
--keystore upload.jks --keystore-password "$KS_PASS" \
--key-alias upload --key-password "$KEY_PASS" \
--upload myapp.aab上述四个标志需配合使用;密码也可来自和环境变量,而非命令行参数。添加可托管提供的密钥,后续构建无需再携带这些标志,只需使用简单的即可。不会覆盖现有密钥:若该应用已托管了不同的密钥,会在创建任何实例前失败。
LIM_KEYSTORE_PASSWORDLIM_KEY_PASSWORD--save-key--sign--save-key需向用户收集以下信息:
- 密钥库文件路径(或
.jks);切勿提交该文件或将其内容粘贴到其他文件中,.p12 - 密钥库密码和密钥密码(通常为同一值),
- 密钥别名(若未知,可通过查看)。
keytool -list -keystore <file>
使用自定义密钥流程中需识别的失败信息:
- :
The organization already has a different upload key escrowed for <app>冲突。使用--save-key的构建会使用已托管的密钥;若仅需本次构建使用提供的密钥签名,可移除--sign,或询问用户哪个密钥是真实的上传密钥。--save-key - :自定义密钥标志组不完整;信息会列出缺失的具体标志。
Signing with your own key requires ... as well - :密码或别名包含ISO-8859-1之外的字符。请使用keytool(
signing <field> contains an unsupported character、-storepasswd或-keypasswd)将其修改为Latin-1值。切勿重新生成密钥本身:这会更改上传密钥。-changealias
Publish to Play Store
发布到Play Store
You cannot run the publish itself: it is a browser flow with a Google sign-in.
Prepare the artifact, then hand off:
bash
lim gradle build . --sign --upload-to-playstore --playstore-service-account sa.json --auto-version-code--auto-version-codeexpo.android.versionCodeversionCodeapp/bash
lim gradle build . --sign --upload <app>-v<versionCode>.aabTell the user to open https://console.limrun.com and, on the Secrets page,
click Connect Play Console to sign in with a Google account that has
release access to the app (the session lives in the browser only; nothing is
stored). Then on the Registry page they click Publish to Play Store on
the uploaded AAB and enter the package name (the application ID). The app
listing must already exist in Play Console. Google Play requires a versionCode
it has never seen: handles that on publish builds;
without it, bump in (Expo:
in app.json) before the build.
--auto-version-codeversionCodeapp/build.gradle(.kts)expo.android.versionCodeFailure strings to recognize on the path:
--sign- : detection found no
Cannot determine the Android application ID for signingandroid.package and noapp.jsoninapplicationId; passapp/build.gradle(.kts).--application-id <id> - : the explicit
--sign produces a Play-ready signed AAB; include a bundle tasklist has no bundle task; add--taskor dropbundleRelease.--task - : the server's post-build check found an unsigned bundle; the signing config was not applied. Not a problem in the user's code; retry, and report it if it persists.
the built AAB carries no signature
你无法直接执行发布操作:这是一个需要Google登录的浏览器流程。请先准备好产物,再移交用户操作:
bash
lim gradle build . --sign --upload-to-playstore --playstore-service-account sa.json --auto-version-code--auto-version-codeapp.jsonexpo.android.versionCodeapp/versionCodebash
lim gradle build . --sign --upload <app>-v<versionCode>.aab告知用户打开https://console.limrun.com,在**Secrets**页面点击**Connect Play Console**,使用拥有应用发布权限的Google账号登录(会话仅存在于浏览器中;无任何信息被存储)。然后在Registry页面,点击已上传AAB旁的Publish to Play Store,输入包名(即应用ID)。应用列表必须已在Play Console中存在。Google Play要求使用从未使用过的versionCode:发布构建时优先使用;若未使用,请在构建前修改中的(Expo项目为中的)。
--auto-version-codeapp/build.gradle(.kts)versionCodeapp.jsonexpo.android.versionCode使用流程中需识别的失败信息:
--sign- :检测未找到
Cannot determine the Android application ID for signing中的android.package或app.json中的app/build.gradle(.kts);请传递applicationId。--application-id <id> - :显式指定的
--sign produces a Play-ready signed AAB; include a bundle task列表中无bundle任务;请添加--task或移除bundleRelease。--task - :服务器构建后检查发现bundle未签名;签名配置未生效。这并非用户代码问题;请重试,若问题持续则上报。
the built AAB carries no signature
Gotchas
注意事项
- Build errors are your job to fix. If a build fails, read the error output, fix the code, and rebuild. Don't ask the user to fix build errors.
- Instance reuse is per git worktree. Commands resolve the remembered
instance from the worktree of your cwd; pass (from
--id <gradle-instance-id>) to target a specific one.lim gradle list - versionCode must increase for every Play upload. Prefer
on publish builds. A rejected publish saying the version code already exists means bump, rebuild, republish. If a publish RETRY reports it, the earlier attempt already succeeded; don't publish again.
--auto-version-code - Application ID detection reads the first uncommented . Flavor-specific IDs and dynamic Gradle logic are out of its scope; use
applicationIdthere.--application-id - Keystore passwords must be non-empty and ISO-8859-1. Empty passwords and characters outside Latin-1 are rejected at request time instead of failing minutes into the build.
- Keep synced files small and out of build dirs. Root-level ,
build/,.gradleand any.kotlinnever sync, andlocal.propertiesfiles (including nested ones) are honored. Use.gitignorefor other large local artifacts and--ignore <regex>to force-sync gitignored inputs the build needs.--include <regex>
- 构建错误由你负责修复。若构建失败,请读取错误输出,修复代码后重新构建。不要让用户修复构建错误。
- 实例复用基于git工作区。命令会根据当前工作目录的工作区解析已保存的实例;如需指定特定实例,请传递(来自
--id <gradle-instance-id>)。lim gradle list - 每次Play Store上传的versionCode必须递增。发布构建时优先使用。若发布被拒绝并提示版本代码已存在,请递增versionCode后重新构建并发布。若发布重试时出现该提示,说明之前的尝试已成功;请勿再次发布。
--auto-version-code - 应用ID检测会读取第一个未注释的。变体特定ID和动态Gradle逻辑不在其识别范围内;此类情况请使用
applicationId。--application-id - 密钥库密码必须非空且符合ISO-8859-1标准。空密码和Latin-1之外的字符会在请求时被拒绝,避免构建数分钟后失败。
- 同步文件请保持体积小且避免同步构建目录。根目录下的、
build/、.gradle及任何.kotlin文件永远不会被同步,且会遵循local.properties文件(包括嵌套的.gitignore)。对于其他大型本地产物,可使用.gitignore忽略;对于构建所需的、被git忽略的输入文件,可使用--ignore <regex>强制同步。--include <regex>