首页指南参考教程

提交到 Google Play 商店

了解如何从计算机和 CI 向 Google Play 商店提交应用。


本指南概述了如何从你自己的计算机和 CI 向 Google Play 商店提交应用。

¥This guide outlines how to submit your app to the Google Play Store from your own computer and from CI.

先决条件

¥Prerequisites

  • 需要付费开发者账户 — 你可以在 Google Play 管理中心注册页面 上创建 Google Play 开发者账户。

    ¥A paid developer account is required — You can create a Google Play Developer account on the Google Play Console sign-up page.

  • 你必须创建 谷歌服务账户 并下载其 JSON 私钥。

    ¥You have to create a Google Service Account and download its JSON private key.

  • 之后,你必须在 谷歌游戏控制台 上创建一个应用并至少手动上传一次应用。

    ¥After that, you'll have to create an app on Google Play Console and upload your app manually at least once.

  • 你还需要安装 EAS CLI 并使用你的 Expo 账户进行身份验证:

    ¥You will also need to have EAS CLI installed and authenticated with your Expo account:

Terminal
npm install -g eas-cli && eas login

创建 Google 服务账户

¥Creating a Google Service Account

欲了解更多信息,请参阅 expo.fyi/creating-google-service-account

¥For more information, see expo.fyi/creating-google-service-account.

首次手动上传你的应用

¥Manually uploading your app for the first time

在使用 eas submit -p android 上传构建之前,你必须至少手动上传应用一次。这是 Google Play 商店 API 的限制。

¥Before using eas submit -p android for uploading your builds, you have to upload your app manually at least once. This is a limitation of the Google Play Store API.

欲了解更多信息,请参阅 expo.fyi/first-android-submission

¥For more information, see expo.fyi/first-android-submission.

1. 构建一个独立的应用

¥ Build a standalone app

你需要一个经过签名的原生应用二进制文件才能提交商店。你可以使用 EAS 构建 或自行完成。

¥You'll need a native app binary signed for store submission. You can either use EAS Build or do it on your own.

2. 开始提交

¥ Start the submission

要将二进制文件提交到 Play 商店,请从项目目录中运行 eas submit -p android。该命令将引导你逐步完成提交应用的过程。请参阅 使用 eas.json 进行配置 页面以了解如何预先配置你的提交。

¥To submit the binary to the Play Store, run eas submit -p android from inside your project directory. The command will lead you step by step through the process of submitting the app. See the Configuration with eas.json page to learn how to pre-configure your submission.

尽管可以将任何二进制文件上传到商店,但每次提交都与一个 Expo 项目相关联。这就是为什么从项目目录中开始提交很重要 - 这就是你的 应用配置 被定义的地方。

¥Although it's possible to upload any binary to the store, each submission is associated with an Expo project. That's why it's important to start a submission from inside your project's directory - that's where your app configuration is defined.

要将 Android 应用上传到 Google Play 商店,请运行 eas submit --platform android 并按照屏幕上的说明进行操作。

¥To upload your Android app to the Google Play Store, run eas submit --platform android and follow the instructions on the screen.

该命令将执行以下步骤:

¥The command will perform the following steps:

  • 登录你的 Expo 账户并确保你的应用项目存在于 EAS 服务器上。

    ¥Log in to your Expo account and ensure that your app project exists on EAS servers.

  • 提示输入 Android 包名称,除非在应用配置中设置了 android.package

    ¥Prompt for the Android package name unless android.package is set in the app config.

  • 询问要提交哪个二进制文件。你可以选择以下选项之一:

    ¥Ask for which binary to submit. You can select one of the following:

    • EAS 服务器上项目的最新 Android 版本已完成。

      ¥The latest finished Android build for the project on EAS servers.

    • 特定的构建 ID。它可以在 构建仪表板 上找到。

      ¥Specific build ID. It can be found on the builds dashboard.

    • 本地文件系统上 .apk 或 .aab 存档的路径。

      ¥Path to an .apk or .aab archive on your local filesystem.

    • 应用存档的 URL。

      ¥URL to the app archive.

    如果提供以下 CLI 参数之一,则可以跳过此步骤:--latest--id--path--url

    ¥This step can be skipped if one of the following CLI parameters is provided: --latest, --id, --path, or --url.

  • 除非 eas.json 中提供了 serviceAccountKeyPath,否则系统将提示你输入 Google 服务 JSON 密钥的路径。

    ¥Unless serviceAccountKeyPath is provided in eas.json, you will be prompted for the path to your Google Services JSON key.

  • 将显示所提供配置的摘要,并开始提交过程。屏幕上会显示提交进度。

    ¥The summary of provided configuration is displayed and the submission process begins. The submission progress is displayed on the screen.

  • 你的构建现在应该可以在 Google Play Console 上看到。如果出现问题,屏幕上会显示相应的消息。

    ¥Your build should now be visible on Google Play Console. If something goes wrong, an appropriate message is displayed on the screen.

使用 CI 提交你的应用

¥Submitting your app using CI

eas submit 命令可以从 CI 环境执行提交。你所要做的就是确保通过 eas.json 和环境变量提供了所有必需的信息。主要是提供存档源(--latest--id--path--url)是必不可少的。另外,请确保你的 应用配置文件.conf 中存在 Android 软件包名称。

¥The eas submit command can perform submissions from a CI environment. All you have to do is ensure that all required information is provided with eas.json and environment variables. Mainly, providing the archive source (--latest, --id, --path, or --url) is essential. Also, make sure that the Android package name is present in your app config file.

对于 Android 提交,你必须使用 eas.json 中的 serviceAccountKeyPath 密钥提供 Google 服务 JSON 密钥的路径。你可能还会发现 trackreleaseStatus 参数很有用。

¥For Android submissions, you must provide the path to your Google Services JSON key using the serviceAccountKeyPath key in eas.json. You may also find the track and releaseStatus parameters useful.

用法示例:

¥Example usage:

Terminal
eas submit -p android --profile foobar

自动提交

¥Automating submissions

要了解如何在成功构建后自动提交应用,请参阅 自动提交

¥To learn how to automatically submit your app after a successful build, refer to the Automating submissions.

Expo 中文网 - 粤ICP备13048890号