Skip to content
Open
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
54 changes: 54 additions & 0 deletions docs/markdown/Android-module.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Android module

This module provides mechanisms to build applications on Android.

## Usage

To use this module, just do: **`android = import('android')`**. The
following functions will then be available as methods on the object
with the name `android`. You can, of course, replace the name
`android` with anything else.

### android.generate_apk()

```
android.generate_apk(manifest: string | File | CustomTarget | CustomTargetIndex | GeneratedList,
sources ... : string | File | CustomTarget | CustomTargetIndex | GeneratedList | Jar,
app_id: string | None = None,
target_sdk: int | None = None,
min_sdk: int | None = None,
resources: [](string | File | CustomTarget | CustomTargetIndex | GeneratedList) = [],
install: bool = false,
install_dir: string | None = None,
install_tag: string | None = None,
): CustomTarget
```

This function generates an Android APK file based on the manifest and
sources passed to it.

**DO NOT** use this for deploying production applications. The format
this effectivly produces (arch-split APKs) is not accepted by Google
anymore and the new application bundle format is entirely incompatible
with the way meson works. For production applications, look instead at
[Building Android apps with native code using Meson](https://nibblestew.blogspot.com/2025/10/building-android-apps-with-native-code.html).

* `manifest`: The AndroidManifest.xml file describing your application
* `sources`: java source files are jars that compose your application
* `app_id`: the application package identifier (typically a domain you
control in big endian format). This is optional if the
manifest already contains a package id.
* `target_sdk`: The SDK version your application targets
* `min_sdk`: The lowest SDK version your application still supports
* `resources`: Files that will be added as resources to the APK (i.e.
drawables, layouts, etc.). *Note:* the directory each
file resides in has to match the resource group that
it is a part of.
* `install`: if true, install the apk file
* `install_dir`: location to install the apk file to
* `install_tag`: A string used by the `meson install --tags` command
to install only a subset of the files.

Returns the target that produces the APK

*Added 1.11.0*
1 change: 1 addition & 0 deletions docs/sitemap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ index.md
Disabler.md
Code-formatting.md
Modules.md
Android-module.md
CMake-module.md
Codegen-module.md
Cuda-module.md
Expand Down
1 change: 1 addition & 0 deletions docs/theme/extra/templates/navbar_links.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
</a>
<ul class="dropdown-menu" id="modules-menu">
@for tup in [ \
("Android-module.html","Android"), \
("CMake-module.html","CMake"), \
("Codegen-module.html","Codegen"), \
("Cuda-module.html","CUDA"), \
Expand Down
4 changes: 3 additions & 1 deletion mesonbuild/modules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@ def find_program(self, prog: T.Union[mesonlib.FileOrString, T.List[mesonlib.File
required: bool = True,
version_func: T.Optional[ProgramVersionFunc] = None,
wanted: T.Union[str, T.List[str]] = '', silent: bool = False,
search_dirs: T.Optional[T.List[str]] = None,
for_machine: MachineChoice = MachineChoice.HOST) -> Program:
if not isinstance(prog, list):
prog = [prog]
return self._interpreter.find_program_impl(prog, required=required, version_func=version_func,
wanted=wanted, silent=silent, for_machine=for_machine)
wanted=wanted, silent=silent, search_dirs=search_dirs,
for_machine=for_machine)

def find_tool(self, name: str, depname: str, varname: str, required: bool = True,
wanted: T.Optional[str] = None, native: bool = True) -> Program:
Expand Down
Loading
Loading