提交到 Google Play 商店
了解如何通过计算机和 CI/CD 服务将应用提交到 Google Play Store。
本指南概述了如何从计算机或 CI/CD 服务将你的应用提交到 Google Play Store。
🌐 This guide outlines how to submit your app to the Google Play Store from your computer or from a CI/CD service.
从你的电脑
🌐 Submitting your app from your computer
7 requirements
7 requirements
1.
注册 Google Play 开发者账号
要将你的应用提交到 Google Play 商店,你需要一个 Google Play 开发者账户。你可以在Google Play 控制台注册页面注册 Google Play 开发者账户。
2.
在 Google Play 控制台创建应用
在Google Play 控制台中点击 创建应用 来创建一个应用。
3.
创建 Google 服务账号
EAS 要求你上传并配置 Google 服务账户密钥,以便提交你的 Android 应用到 Google Play 商店。你可以参照使用 EAS 上传 Google 服务账户密钥以提交到 Play 商店的指南创建密钥。
4.
安装 EAS CLI 并使用你的 Expo 账户进行身份验证
安装 EAS CLI 并使用你的 Expo 账户登录:
- npm install -g eas-cli && eas login5.
在 app.json 中包含包名
在 app.json 中包含你的应用包名:
{ "android": { "package": "com.yourcompany.yourapp" } }
6.
构建一个生产应用
你需要一个可用于商店提交的生产版本。你可以使用 EAS Build 创建一个:
- eas build --platform android --profile production或者,你可以在自己的电脑上使用 eas build --platform android --profile production --local 或者 Android Studio 构建该应用。
7.
至少手动上传一次你的应用
你必须至少手动上传一次你的应用。这是 Google Play 商店 API 的一个限制。
了解如何通过Android 应用首次提交指南。
完成所有先决条件后,即可启动提交流程。
🌐 Once you have completed all the prerequisites, you can start the submission process.
运行以下命令将构建提交到 Google Play Store:
🌐 Run the following command to submit a build to the Google Play Store:
- eas submit --platform android该命令将逐步引导你完成提交应用的过程。你可以通过在 eas.json 中添加提交配置文件来配置提交流程。了解你可以在 eas.json 参考 中提供的所有选项。
🌐 The command will lead you step by step through the process of submitting the app. You can configure the submission process by adding a submission profile in eas.json. Learn about all the options you can provide in the eas.json reference.
为了加快提交过程,你可以使用 --auto-submit 标志在构建完成后自动提交构建:
🌐 To speed up the submission process, you can use the --auto-submit flag to automatically submit a build after it's built:
- eas build --platform android --auto-submit在自动提交指南中了解更多关于 --auto-submit 标志的信息。
🌐 Learn more about the --auto-submit flag in the automate submissions guide.
使用 CI/CD 服务提交你的应用
🌐 Submitting your app using CI/CD services
8 requirements
8 requirements
1.
注册 Google Play 开发者账号
要将你的应用提交到 Google Play 商店,你需要一个 Google Play 开发者账户。你可以在Google Play 控制台注册页面注册 Google Play 开发者账户。
2.
在 Google Play 控制台创建应用
在Google Play 控制台中点击 创建应用 来创建一个应用。
3.
创建 Google 服务账号
EAS 要求你上传并配置 Google 服务账号密钥,以便提交你的 Android 应用到 Google Play 商店。你可以参照使用 EAS 上传 Google 服务账号密钥以提交 Play 商店应用的指南来创建。
4.
安装 EAS CLI 并使用你的 Expo 账户进行身份验证
安装 EAS CLI 并使用你的 Expo 账号登录:
- npm install -g eas-cli && eas login5.
在 app.json 中包含包名
在 app.json 中包含你的应用包名:
{ "android": { "package": "com.yourcompany.yourapp" } }
6.
将你的 Google 服务账户密钥上传到 EAS 仪表板
然后,你需要将 Google 服务账户密钥上传到项目凭据下的 EAS 仪表板。
- 进入你项目的 EAS 仪表板,点击 Credentials,在 Android 下,点击你应用的 Application identifier。
- 在 服务凭据 下,点击 添加 Google 服务账户密钥。
- 在 更改 Google 服务账户密钥 下,确保选择 上传新密钥 并上传下载的 JSON 密钥。这将把密钥添加到你项目的凭据中。
你也可以使用 EAS CLI 将 JSON 密钥上传到 EAS 仪表板:
- 运行
eas credentials --platform android - 当出现提示 你想配置哪个构建配置文件? 时,选择 生产
- 当出现 你想要做什么? 的提示时,选择 Google 服务账号 > 上传 Google 服务账号密钥
- 然后将 JSON 密钥文件路径添加到上传文件到 EAS 仪表板
7.
构建一个生产应用
你需要一个可用于商店提交的生产版本。你可以使用 EAS Build 创建一个:
- eas build --platform android --profile production或者,你可以在自己的电脑上使用 eas build --platform android --profile production --local 或者 Android Studio 构建该应用。
8.
至少手动上传一次你的应用
你必须至少手动上传一次你的应用。这是 Google Play 商店 API 的一个限制。
了解如何通过Android 应用首次提交指南。
完成所有先决条件后,你可以设置 CI/CD 流水线,将你的应用提交到 Google Play 商店。
🌐 Once you have completed all the prerequisites, you can set up a CI/CD pipeline to submit your app to the Google Play Store.
使用 EAS Workflows CI/CD
🌐 Use EAS Workflows CI/CD
你可以使用 EAS Workflows 来自动构建和提交你的应用。
🌐 You can use EAS Workflows to build and submit your app automatically.
-
在项目根目录下创建一个名为 .eas/workflows/submit-android.yml 的工作流文件。
-
在 submit-android.yml 中,你可以使用以下工作流来启动提交 Android 应用的任务:
.eas/workflows/submit-android.ymlon: push: branches: ['main'] jobs: build_android: name: Build Android app type: build params: platform: android profile: production submit_android: name: Submit to Google Play Store needs: [build_android] type: submit params: profile: production build_id: ${{ needs.build_android.outputs.build_id }}上述工作流程将构建 Android 应用,然后将其提交到 Google Play 商店。
使用其他 CI/CD 服务
🌐 Use other CI/CD services
你可以使用其他 CI/CD 服务通过 EAS Submit 提交你的应用,例如 GitHub Actions、GitLab CI 等,只需运行以下命令即可:
🌐 You can use other CI/CD services to submit your app with EAS Submit, like GitHub Actions, GitLab CI, and more by running the following command:
- eas submit --platform android --profile production此命令需要使用 个人访问令牌 来验证你的 Expo 账户。获取令牌后,请在 CI/CD 服务中提供 EXPO_TOKEN 环境变量,这将允许 eas submit 命令运行。
🌐 This command requires a personal access token to authenticate with your Expo account. Once you have one, provide the EXPO_TOKEN environment variable in the CI/CD service, which will allow the eas submit command to run.