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 } }}
构建 APK
AAB 格式是上传到 Google Play 的推荐捆绑文件,但也可以生成 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 是通用的,包含所有支持的目标。要为每个目标生成单独的捆绑包,请使用 --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
更改最低支持的 Android 版本
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 中上传它。
首次上传必须在网站上手动完成,以便它可以验证您的应用签名和捆绑包标识符。Tauri 目前不提供自动化创建 Android 版本的方法,这需要利用 Google Play Developer API,但这项工作正在进行中。
© 2025 Tauri 贡献者。CC-BY / MIT