Skip to content

update android docs #3218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 57 additions & 5 deletions versions/3.8/en/editor/publish/android/build-options-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ The build options for the Android platform are as follows:

This option actively adjusts the rendering time to match the screen refresh rate, achieving stable frame rates and reducing unnecessary rendering. The build parameter is `swappy`.

For more information, refer to the official documentation on [Frame Pacing Library Overview](https://source.android.com/devices/graphics/frame-pacing)
For more information, refer to the official documentation on [Frame Pacing Library Overview](https://source.android.com/devices/graphics/frame-pacing).

## Render Backend

Currently supported options are as follows:

- [VULKAN](https://www.vulkan.org/)
- [GLES3](https://www.khronos.org/registry/OpenGL-Refpages/es3/)
- [GLES2](https://www.khronos.org/registry/OpenGL-Refpages/es2.0/)
Expand All @@ -39,16 +40,16 @@ Set the Target API Level required for Android platform compilation. Clicking the

Set the CPU types that your Android app needs to support. You can choose one or more options, including `armeabi-v7a`, `arm64-v8a`, `x86`, and `x86_64`.

**Note**:
**Notes**:

1. When you select one ABI and build it without cleaning, both ABIs' shared objects (so) will be packaged into the APK. This is the default behavior of Android Studio. If you import the project into Android Studio, after building one ABI, perform **Build -> Clean Project** before building another ABI. This way, only the latter ABI will be packaged into the APK
1. When you select one ABI and build it without cleaning, both ABIs' shared objects (so) will be packaged into the APK. This is the default behavior of Android Studio. If you import the project into Android Studio, after building one ABI, perform **Build -> Clean Project** before building another ABI. This way, only the latter ABI will be packaged into the APK.

2. After importing the project into Android Studio, it exists independently and is not dependent on the build and release panel. If you need to modify the ABI, directly modify the **PROP_APP_ABI** property in the `gradle.properties` file.
![modify abi](../publish-native/modify_abi.png)

## Use Debug Keystore

Android requires that all APKs be digitally signed with a certificate before they can be installed. Cocos Creator provides a default keystore, and checking **Use Debug Keystore** means using the default keystore. If developers need a custom keystore, uncheck **Use Debug Keystore**. For more details, refer to the [Android Developer - App Signing](https://developer.android.google.cn/studio/publish/app-signing)
Android requires that all APKs be digitally signed with a certificate before they can be installed. Cocos Creator provides a default keystore, and checking **Use Debug Keystore** means using the default keystore. If developers need a custom keystore, uncheck **Use Debug Keystore**. For more details, refer to the [Android Developer - App Signing](https://developer.android.google.cn/studio/publish/app-signing).

## Orientation

Expand All @@ -63,11 +64,62 @@ The screen orientation currently includes three options: **Portrait**, **Landsca
Checking this option allows you to package and publish your game to Google Play Instant. Google Play Instant is dependent on Google Play and is not a separate distribution channel but rather a game streaming solution. It enables players to try, share, and engage with your game instantly without the need to install it.

**Note the following points when using Google Play Instant:**

1. Android Studio version should be 4.0 or above.
2. Android phones running Android 6.0 or above. Devices with Android SDK versions between 6.0 and 7.0 require the installation of Google Play Services Framework, while devices with SDK versions 8.0 or above do not require it and can use the services directly.
3. For the first build, you need to open the built project with Android Studio to download the Google Play Instant Development SDK (Windows) or Instant Apps Development SDK (Mac) support package. If the download fails, it is recommended to set up an HTTP proxy for Android Studio.
![Google Play Instant](../publish-native/sdk-android-instant.png)

## Generate App Bundle(Google Play)

Checking this option allows you to package your game as an App Bundle format for uploading to the Google Play Store. For more information, refer to the [Android Developer - App Bundle](https://developer.android.google.cn/guide/app-bundle/)。
Checking this option allows you to package your game as an App Bundle format for uploading to the Google Play Store. For more information, refer to the [Android Developer - App Bundle](https://developer.android.google.cn/guide/app-bundle/).

## Other Options

Some SDK and NDK options need to be set in the preferences. In addition to setting them in the preferences, you can also pass specified parameters through the build command line.

**sdkPath**: Specify the SDK path
**ndkPath**: Specify the NDK path

You can export the build configuration and add the corresponding parameters in the Android options.

## Build Parameter Interface Definition (used to modify parameters during command line builds)

```ts
interface IOptions {
packageName: string;
resizeableActivity: boolean;
maxAspectRatio: string;
orientation: {
landscapeRight: boolean;
landscapeLeft: boolean;
portrait: boolean;
upsideDown: boolean;
},

apiLevel: number;
appABIs: IAppABI[];

useDebugKeystore: boolean;
keystorePath: string;
keystorePassword: string;
keystoreAlias: string;
keystoreAliasPassword: string;

appBundle: boolean;
androidInstant: boolean;
inputSDK: boolean;
remoteUrl: string;
sdkPath: string;
ndkPath: string;
javaHome?: string;
javaPath?: string;

swappy: boolean;

renderBackEnd: {
vulkan: boolean;
gles3: boolean;
gles2: boolean;
}
}
51 changes: 51 additions & 0 deletions versions/3.8/zh/editor/publish/android/build-options-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,54 @@ Android 要求所有 APK 必须先使用证书进行数字签署,然后才能
## 生成 App Bundle(Google Play)

勾选该项即可将游戏打包成 App Bundle 格式用于上传到 Google Play 商店。具体请参考 [官方文档](https://developer.android.google.cn/guide/app-bundle/)。

## 其他选项

安卓有部分 SDK,NDK 选项需要在偏好设置里设置,除了在偏好设置以外还可以通过构建参数传递指定。

**sdkPath**: 指定 SDK 路径
**ndkPath**: 指定 NDK 路径

可以通过导出构建配置,并在安卓对应的选项内添加参数即可。

## 构建参数接口定义(用于命令行构建修改参数)

```ts
interface IOptions {
packageName: string;
resizeableActivity: boolean;
maxAspectRatio: string;
orientation: {
landscapeRight: boolean;
landscapeLeft: boolean;
portrait: boolean;
upsideDown: boolean;
},

apiLevel: number;
appABIs: IAppABI[];

useDebugKeystore: boolean;
keystorePath: string;
keystorePassword: string;
keystoreAlias: string;
keystoreAliasPassword: string;

appBundle: boolean;
androidInstant: boolean;
inputSDK: boolean;
remoteUrl: string;
sdkPath: string;
ndkPath: string;
javaHome?: string;
javaPath?: string;

swappy: boolean;

renderBackEnd: {
vulkan: boolean;
gles3: boolean;
gles2: boolean;
}
}
```