Google Play
Google Play 是由 Google 维护的 Android 应用分发服务。
本指南涵盖了在 Google Play 上发布 Android 应用的要求。
要在 Play 商店中分发 Android 应用,您必须创建一个 Play Console 开发者帐户。
此外,您必须设置代码签名。
有关更多信息,请参阅发布清单。
运行 tauri android init
设置 Android Studio 项目后,您可以使用 tauri icon
命令更新应用图标。
npm run tauri icon /path/to/app-icon.png
yarn tauri icon /path/to/app-icon.png
pnpm tauri icon /path/to/app-icon.png
deno task tauri icon /path/to/app-icon.png
bun tauri icon /path/to/app-icon.png
cargo tauri icon /path/to/app-icon.png
创建 Play Console 开发者帐户后,您需要在 Google Play Console 网站上注册您的应用。它将引导您完成所有必需的表格和设置任务。
您可以通过运行以下命令构建 Android App Bundle (AAB) 以上传到 Google Play
npm run tauri android build -- --aab
yarn tauri android build --aab
pnpm tauri android build --aab
deno task tauri android build --aab
bun tauri android build --aab
cargo tauri android build --aab
Tauri 从 tauri.conf.json > version
中定义的值派生版本代码 (versionCode = major*1000000 + minor*1000 + patch
)。如果您需要不同的版本代码方案(例如顺序代码),可以在 [tauri.conf.json > bundle > android > versionCode
] 配置中设置自定义版本代码
{ "bundle": { "android": { "versionCode": 100 } }}
AAB 格式是推荐上传到 Google Play 的 bundle 文件,但也可以生成用于测试或非商店分发的 APK。要为您的应用编译 APK,您可以使用 --apk
参数
npm run tauri android build -- --apk
yarn tauri android build --apk
pnpm tauri android build --apk
deno task tauri android build --apk
bun tauri android build --apk
cargo tauri android build --apk
默认情况下,Tauri 为所有支持的架构(aarch64、armv7、i686 和 x86_64)构建您的应用程序。要仅为目标子集编译,您可以使用 --target
参数
npm run tauri android build -- --aab --target aarch64 --target armv7
yarn tauri android build --aab --target aarch64 --target armv7
pnpm tauri android build --aab --target aarch64 --target armv7
deno task tauri android build --aab --target aarch64 --target armv7
bun tauri android build --aab --target aarch64 --target armv7
cargo tauri android build --aab --target aarch64 --target armv7
默认情况下,生成的 AAB 和 APK 是通用的,包含所有受支持的目标。要为每个目标生成单独的 bundle,请使用 --split-per-abi
参数。
npm run tauri android build -- --apk --split-per-abi
yarn tauri android build --apk --split-per-abi
pnpm tauri android build --apk --split-per-abi
deno task tauri android build --apk --split-per-abi
bun tauri android build --apk --split-per-abi
cargo tauri android build --apk --split-per-abi
Tauri 应用程序支持的最低 Android 版本是 Android 7.0(代号 Nougat,SDK 24)。
有一些技术可以在支持旧系统的同时使用更新的 Android API。有关更多信息,请参阅 Android 文档。
如果您的应用必须在更新的 Android 版本上执行,您可以配置 [tauri.conf.json > bundle > android > minSdkVersion
]
{ "bundle": { "android": { "minSdkVersion": 28 } }}
构建您的应用并生成 Android App Bundle 文件(可在 gen/android/app/build/outputs/bundle/universalRelease/app-universal-release.aab
找到)后,您现在可以在 Google Play Console 中创建新版本并上传。
首次上传必须在网站上手动进行,以便验证您的应用签名和 bundle 标识符。Tauri 目前不提供自动化创建 Android 版本的方式,这必须利用 Google Play Developer API,但它正在开发中。
© 2025 Tauri 贡献者。CC-BY / MIT