- Qbs Manual
- QbsModules
- Android.sdk
- Qbs 2.6.0

# Android.sdk

Provides support for building Android packages. More...

Since: | Qbs 1.4

- List of all members, including inherited members

## Properties

- aaptName : string `(since Qbs 1.17)`
- aidlSearchPaths : stringList
- apkBaseName : string
- assetsDir : path
- automaticSources : bool
- buildToolsVersion : string
- d8Desugaring : bool `(since Qbs 2.5)`
- dexCompilerName : string `(since Qbs 1.20)`
- embedJar : bool `(since Qbs 1.10)`
- extraResourcePackages : stringList `(since Qbs 2.5)`
- manifestFile : string
- minimumVersion : string `(since Qbs 1.17)`
- ndkDir : string
- packageName : string
- packageType : string `(since Qbs 1.17)`
- platform : string
- resourcesDir : path
- sdkDir : string
- sourcesDir : path
- targetVersion : string `(since Qbs 1.17)`
- versionCode : string
- versionName : string

## Detailed Description

The Android.sdk module contains the properties and rules to create Android application packages from Java sources, resources, and so on. It is usually pulled in indirectly by declaring an Application product.

### Relevant File Tags

Tag | Auto-tagged File Names | Since | Description
--- | --- | --- | ---
`"android.aidl"` | `*.aidl` | 1.4.0 | Attached to Android AIDL files. One Java source file will be generated for each such file.
`"android.assets"` | - | 1.4.0 | Attached to Android assets, which are typically located in an `assets/` subdirectory. These files are tagged automatically if the automaticSources property is enabled.
`"android.manifest"` | `AndroidManifest.xml` | 1.4.0 | Attached to the Android manifest. There must be one such file for every Android app.
`"android.resources"` | - | 1.4.0 | Attached to Android resources, which are typically located in a `res/` subdirectory. These files are tagged automatically if the automaticSources property is enabled.

## Property Documentation

aaptName : string `[since Qbs 1.17]`

Name of the aapt binary. Allowed options: "aapt" and "aapt2".

Default: `"aapt2"`

This property was introduced in Qbs 1.17.

aidlSearchPaths : stringList

Search paths for import statements to pass to the `aidl` tool via the `-I` option.

apkBaseName : string

The base name of the APK file to to be built, that is, the file name without the ".apk" extension.

Default: packageName

assetsDir : path

The base directory for Android assets in the respective product.

Note: Android requires that the file name of this directory is always `"assets"`.

Default: `"src/main/assets"` in the product source directory

automaticSources : bool

If `true`, Java sources as well as Android resources, assets, and the manifest file will be automatically included in the respective product via wildcards. Set this property to `false` if you want to specify these files manually.

Default: `true`

buildToolsVersion : string

The version of the build tools such as `aapt` and `dx`.

Default: Highest build tools version version available in the SDK.

d8Desugaring : bool `[since Qbs 2.5]`

Whether desugaring is enabled for "d8" dex compiler.

Default: `false`

This property was introduced in Qbs 2.5.

dexCompilerName : string `[since Qbs 1.20]`

Name of the dex compiler binary. Allowed options: "dx" and "d8".

Default: `"d8"`

This property was introduced in Qbs 1.20.

embedJar : bool `[since Qbs 1.10]`

If `true`, then if the dependency is a JAR file, its classes and the classes of its dependencies (if `embedJar` is also true for them) will be recursively processed by `dex` and included in the final APK.

Default: `true`

This property was introduced in Qbs 1.10.

extraResourcePackages : stringList `[since Qbs 2.5]`

List of additional Java package names to compile resources for.

Default: `undefined`

This property was introduced in Qbs 2.5.

manifestFile : string

The file path to the Android manifest file. This property is only relevant if automaticSources is enabled.

Note: Android requires that the file name is always "AndroidManifest.xml".

Default: `"src/main/AndroidManifest.xml"` in the product source directory

minimumVersion : string `[since Qbs 1.17]`

Minimum API Level required for the application to run.

Default: `"21"`

This property was introduced in Qbs 1.17.

ndkDir : string

The NDK base directory, if an NDK is present.

Default: Determined automatically based on standard search paths.

packageName : string

The package name of the respective product. The `package` attribute in the manifest file will be set to this value automatically.

Default: `name`

packageType : string `[since Qbs 1.17]`

Type of the package. Allowed options: "apk" and "aab". Type "apk" generates a runnable package whereas "aab" generates a package for Google Play.

Default: `"apk"`

This property was introduced in Qbs 1.17.

platform : string

The versioned platform name (for example, `"android-21"`).

Default: Highest build tools version version available in the SDK.

resourcesDir : path

The base directory for Android resources in the respective product.

Note: Android requires that the file name of this directory is always `"res"`.

Default: `"src/main/res"` in the product source directory

sdkDir : string

The SDK base directory.

Default: Determined automatically based on standard search paths.

sourcesDir : path

The base directory for Java sources. This property is only relevant if automaticSources is enabled.

Default: `"src/main/java"` in the product source directory

targetVersion : string `[since Qbs 1.17]`

API Level that the application targets.

Default: `platformVersion`

This property was introduced in Qbs 1.17.

versionCode : string

The Android Manifest version code of the respective product. The `android:versionCode` attribute in the manifest file will be set to this value if not undefined.

In the following example we provide an architecture-specific value for `android:versionCode`:

     // ...
     property int _version: 1
     property int _patchVersion: 0
     Android.sdk.versionCode: {
         switch (Android.ndk.abi) {
         case "armeabi-v7a":
             return 132000000 | _version * 10 + _patchVersion;
         case "arm64-v8a":
             return 164000000 | _version * 10 + _patchVersion;
         case "x86":
             return 232000000 | _version * 10 + _patchVersion;
         case "x86_64":
             return 264000000 | _version * 10 + _patchVersion;
         }
         throw "Unknown architecture";
     }

Default: `undefined`

versionName : string

The Android Manifest version name of the respective product. The `android:versionName` attribute in the manifest file will be set to this value if not undefined.

Default: `undefined`