Updated on 2026-01-08 GMT+08:00

Building with Android

The Android build system compiles application resources and source code, and then packages them into APKs that can be deployed, signed, and distributed.

Custom Installation

sdkmanager command (sdkmanager packages [options]): installs the required Android build environment. For example, sdkmanager "platform-tools" "platforms;android-28" --sdk_root=./ indicates that sdkmanager is used to download platform-tools and platforms;android-28 to the root directory of the current code.

Graphical Build

Add Build with Android, when configuring build actions.

The parameters are described in the following table.

Parameter

Description

Action Name

Assign a custom name to the build action.

Gradle

Select a Gradle version.

JDK

Select a JDK version.

NDK

Select an NDK version as required. You can also select No.

Commands

Configure the Gradle commands. You can also use default commands.

Code-based Build

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
version: 2.0 # The value must be 2.0.
steps:
  BUILD:
    - android:
        inputs:
          gradle: 4.8 
          jdk: 1.8
          ndk: 17
          command: | 
            cat ~/.gradle/init.gradle
            cat ~/.gradle/gradle.properties
            cat ~/.gradle/init_template.gradle
            rm -rf ~/.gradle/init.gradle
            rm -rf /home/build/.gradle/init.gradle
            # Gradle Wrapper provided by CodeArts is used for cache acceleration.
            cp /cache/android/wrapper/gradle-wrapper.jar ./gradle/wrapper/gradle-wrapper.jar
            # Build an unsigned APK.
            /bin/bash ./gradlew assembleDebug -Dorg.gradle.daemon=false -d --stacktrace

Parameter

Type

Description

Mandatory

Default Value

command

String

Commands to be run.

Yes

None

gradle

String

Gradle version.

Yes

None

jdk

String

JDK version.

Yes

None

ndk

String

NDK version.

Yes

None

Android Version Description

  • SDK: used to specify compileSdkVersion.
  • Build Tools: used to specify buildToolsVersion.

You can find the two versions in the build.gradle file or the global configuration file (user-defined) of the project.

  • Select compileSdkVersion or buildToolsVersion based on project requirements.
  • The Gradle wrapper build mode is also supported. If the provided Gradle version does not meet your requirements, you can run the gradlew command for build using the wrapper. The required Gradle version will be automatically downloaded. Example of the build command: ./gradlew clean build.