Mobile Development 9 min read

Understanding Android VNDK/VSDK Snapshot Architecture

The article explains Android’s VNDK and VSDK Snapshot architecture—key parts of Treble that categorize native libraries, generate prebuilt vendor snapshots, and decouple system and vendor code to reduce fragmentation, improve build efficiency, and enable independent development of system and vendor components.

OPPO Kernel Craftsman
OPPO Kernel Craftsman
OPPO Kernel Craftsman
Understanding Android VNDK/VSDK Snapshot Architecture

This article provides a comprehensive analysis of Android's VNDK (Vendor NDK) and VSDK (Vendor SDK) Snapshot architecture, which are key components of the Treble architecture designed to address Android version fragmentation.

Background:

To solve Android version fragmentation, Google introduced the Treble architecture, which provides stable new SoC vendor interfaces using HIDL/Stable AIDL (Binder-based). This architecture decouples system framework from vendor HAL, making Vendor Freeze possible. Research shows that 30-40% of AOSP vendor repositories were coupled with system components, including framework, prebuilts, external, platform, ODM, and build repositories.

Starting from Android R, Google enhanced the system/vendor interface capabilities through VNDK and VSDK snapshot solutions, enabling system components to be precompiled into vendor Snapshots for use across different Android versions.

VNDK Basic Concepts:

VNDK categorizes Native libraries to control system/vendor coupling:

Core Library: Only in system image, used only by system modules, cannot be depended on by vendor, vendor_available, vndk, or vndk-sp libraries

Vendor-only Library: Only for vendor use, binary in vendor image

Vendor_available Library: Used by vendor image, exists in both vendor and core variants, packaged in both images

VNDK Library: Used by vendor modules, binary in system image

VNDK-SP Library: Directly used by vendor, indirectly used by system, binary in system image

LLNDK Library: Maintained by Google, used by both system and vendor, can double load

VSDK Concepts:

VSDK includes VNDK plus Vendor Snapshot. Vendor Snapshot contains: dynamic/static libraries with vendor or vendor_available flags, static VNDK libraries with vendor_available flag, and executables or target files with vendor flags.

Snapshot Generation Process:

The Snapshot generation involves three phases:

Generate Phase: Produces prebuilt snapshot modules from system source code for vendor image compilation

Install Phase: Python scripts install prebuilt modules to designated source directories and generate corresponding Android.bp files

Use Phase: Setting BOARD_VNDK_VERSION triggers the build system to use pre-generated Snapshots, blocking source compilation for related modules

Benefits:

Improved vendor component compilation efficiency

Enhanced code cognition management - decoupled repositories can remove vendor coupling repositories

Better support for independent development of system/vendor components

AndroidsnapshotAndroid SystemNative LibrariesTreble ArchitectureVendor DevelopmentVNDKVSDK
OPPO Kernel Craftsman
Written by

OPPO Kernel Craftsman

Sharing Linux kernel-related cutting-edge technology, technical articles, technical news, and curated tutorials

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.