A VNDK snapshot is a set of VNDK-core and VNDK-SP libs for an Android release.
You can upgrade only the system partition if the
includes the corresponding VNDK snapshot needed by the
Official VNDK snapshots are built automatically on the Android build server
and checked into
/prebuilts/vndk of the Android source tree. For
development purposes, you can build VNDK snapshots locally. VNDK snapshots are
supported for arm, arm64, x86, and x86_64
The Android build server generates build artifacts and VNDK snapshot files using the following build parameters and build commands.
The build target name is
vndk. The build target configuration
is shown below.
TARGET_ARCHis the same as Generic System Image (GSI) target archs (
TARGET_ARCH_VARIANT. For snapshot v28 (Android 9) and higher, includes popular configurations listed above.
For official snapshots, Android 9 and higher
includes a sample target (
vndk.mk that builds and outputs a VNDK
$DIST_DIR. The snapshot ZIP file uses the format
make -j vndk dist [BOARD_VNDK_VERSION=current]
The Android build server uses the
build.sh script to build all supported arch
flavors with the following command.
The VNDK snapshot for an Android version is generated from that version's release branch.
During development, you can build VNDK snapshots from a local source tree with the following commands.
- To build all supported archs at once, execute the following build script
- To build one specific
TARGET_ARCH, execute the following commands.
m -j vndk dist
android-vndk-$(TARGET_ARCH).zip file is created
A VNDK snapshot includes the following files.
- Vendor variant of VNDK-core and VNDK-SP shared libraries.
- LL-NDK shared libs aren't needed as they're backward compatible.
- For 64 bit targets, both
TARGET_2ND_ARCHlibraries are built and included.
- List of VNDK-core, VNDK-SP, LL-NDK, and VNDK-private libraries is at
- License files.
module_paths.txt. Records the module paths for all VNDK libraries, which is needed for checking that GPL projects have sources released in a given Android source tree.
For a given VNDK snapshot ZIP file,
android-vndk-$(TARGET_ARCH).zip, the VNDK prebuilt libraries are
grouped in separate directories named
arch-$(TARGET_ARCH)-$(TARGET_ARCH_VARIANT) according to ABI
bitness. For example, for
android-vndk-arm64.zip, the 64-bit libs
are placed under
arch-arm64-armv8-a and the 32-bit libs are
arch-arm-armv8-a. The example below shows the
directory structure for an arm64 (
snapshot ZIP file (
Building for vendor snapshots
Android 11 supports
snapshots, which enable you to build
vendor.img regardless of
the Android version on the source tree. A default VNDK snapshot contains the
shared library files (
.so) that can be installed to devices and
then linked from vendor C++ binaries in runtime. To build against
that VNDK snapshot, you need additional artifacts such as header files and
To generate such artifacts (along with the VNDK snapshot) from a local source tree, use the following command.
This command creates
android-vndk-$(TARGET_ARCH).zip files under
$DIST_DIR. The example below is an arm64 VNDK snapshot ZIP file
with build artifacts. The bolded files are newly added files to normal VNDK
snapshot (shown in Figure 1) and include JSON files (which store
cflags of each library) and all exported header files.
android-vndk-arm64.zip ├── arch-arm64-armv8-a │ └── shared │ ├── vndk-core -> *.so files, *.json files │ └── vndk-sp -> *.so files, *.json files ├── arch-arm-armv8-a -> (same as arch-arm64-armv8-a) ├── configs -> *.libraries.txt, module_paths.txt, module_names.txt ├── include -> exported header files (*.h, *.hh, etc.) └── NOTICE_FILES -> license txt files
Uploading VNDK snapshots
VNDK snapshots are checked in the source tree under
VER is equal to the version of the VNDK snapshot
(which follows the SDK version of the corresponding Android release). For
example, the Android 8.1 VNDK snapshot has version 27.
Using the update.py script
/development/vndk/snapshot/update.py) automates the process of
adding a prebuilt VNDK snapshot to the source tree. It automatically detects
build artifacts and appropriately fills in the associated properties in the
Android.bp. This script performs the following tasks:
repo startto create new Git branch.
- Fetches and unzips VNDK snapshot build artifacts.
gen_buildfiles.pyto auto generate the build files (
check_gpl_license.pyto verify the prebuilt libraries licensed under the General Public License (GPL) have sources released in current source tree.
git committo commit new changes.
Using locally built VNDK snapshots
You can also use locally built VNDK snapshots. When the
option is specified, the
update.py script fetches VNDK snapshot
build artifacts from the specified local directory (instead of the Android
build server) that has the
generated from the
development/vndk/snapshot/build.sh. With the
--local option, the
update.py script skips the GPL
license checking and
git commit steps.
python update.py VER --local local_path
Example command for updating the Android 8.1 VNDK snapshot with local build
python update.py 27 --local /path/to/local/dir
Example directory structure of a locally built VNDK snapshot:
prebuilts/vndk ├── v30 │ ├── arm64 │ │ ├── arch-arm64-armv8-a -> (prebuilt libs) │ │ ├── arch-arm-armv8-a -> (prebuilt libs) │ │ ├── configs -> (config files) │ │ ├── include -> (exported header files) │ │ └── Android.bp -> (VNDK modules with cflags) │ ├── arm -> (same as above) │ ├── x86_64 -> (same as above) │ ├── x86 -> (same as above) │ ├── common │ │ ├── NOTICE_FILES -> (license files) │ │ └── Android.bp -> (license file modules) │ └── Android.bp -> (*.libraries.30.txt modules) └── (other VNDK versions) -> (same as above)Local build artifacts are added automatically if artifacts were built with
Installing VNDK snapshots
The system image installs VNDK snapshot libraries at build time using the
You can control which VNDK snapshots get installed from the prebuilt VNDK
snapshot directories (for example,
/prebuilts/vndk/v30) using one of the following options.
- Option 1:
BOARD_VNDK_VERSION. Use the snapshot modules for building the current vendor modules and install only the snapshot modules that are required for the vendor modules.
- Option 2:
PRODUCT_EXTRA_VNDK_VERSIONS. Install the VNDK snapshot modules regardless of the current vendor modules. This installs the prebuilt VNDK snapshots listed in
PRODUCT_EXTRA_VNDK_VERSIONSwithout linking them to any other modules at build time.
BOARD_VNDK_VERSION shows the VNDK version that current vendor
modules are required to build. If
BOARD_VNDK_VERSION has an
available VNDK snapshot version in
/prebuilts/vndk directory, the
VNDK snapshot indicated in
BOARD_VNDK_VERSION is installed. If
the VNDK snapshot is not available in the directory, a build error occurs.
BOARD_VNDK_VERSION also enables the VNDK modules to be
installed. Vendor modules link with the VNDK snapshot version defined in
BOARD_VNDK_VERSION at build time (this doesn't build current
VNDK modules in the system source). When downloading the full source tree from
a repository, both system and vendor sources are based on the same Android
PRODUCT_EXTRA_VNDK_VERSIONS lists the extra VNDK versions to be
installed. Normally it is enough to have one VNDK snapshot for the current
vendor partition. However, in some cases you might need to include multiple
snapshots in one system image. For example, the GSI has multiple snapshots to
support multiple vendor versions with one system image. By setting
PRODUCT_EXTRA_VNDK_VERSIONS, you can install the VNDK snapshot
modules in addition to the VNDK version in
PRODUCT_EXTRA_VNDK_VERSIONS has a specific list of versions,
the build system looks for prebuilt snapshots of the version list in the
prebuilts/vndk directory. If the build system locates all listed
snapshots, it installs those snapshot files to each VNDK APEX
Missing versions generate a build error.
The VNDK modules don't link with the vendor modules at build time but can be
used at runtime if the vendor modules in the vendor partition require one of
the installed VNDK versions.
PRODUCT_EXTRA_VNDK_VERSIONS is valid
BOARD_VNDK_VERSION is defined.
PLATFORM_VNDK_VERSION defines the VNDK version for current VNDK
modules in the system source. The value is set automatically:
- Prior to release, the
PLATFORM_VNDK_VERSIONis set as
- At release,
PLATFORM_SDK_VERSIONis copied to
After the Android version is released, the current VNDK libraries are
installed to VNDK APEX
VER is the version stored in
BOARD_VNDK_VERSION is set to
PLATFORM_VNDK_VERSION is stored in
BOARD_VNDK_VERSION is stored in
PLATFORM_VNDK_VERSION is set to the
SDK version when Android releases; prior to release, the alphanumeric Android
code name is used for
Summary of VNDK version settings
The table below summarizes the VNDK version settings.
|Current VNDK modules||
|Prebuilt snapshot modules||
|Before or After||
- Board Version (
BOARD_VNDK_VERSION). VNDK version that vendor modules require to build. Set to
currentif vendor modules can link with current system modules.
- Platform Version (
PLATFORM_VNDK_VERSION). VNDK version that current system modules are building. Built only when
- Version Property (
ro.vndk.version). Property that specifies the VNDK version the binaries and libs in vendor.img require to run. Stored in the