Native code compatibility is challenging. For this reason, device implementers are STRONGLY RECOMMENDED to use the implementations of the libraries listed below from the upstream Android Open Source Project.
Managed Dalvik bytecode can call into native code provided in the application .apk file as an ELF .so file compiled for the appropriate device hardware architecture. As native code is highly dependent on the underlying processor technology, Android defines a number of Application Binary Interfaces (ABIs) in the Android NDK. Device implementations MUST be compatible with one or more defined ABIs, and MUST implement compatibility with the Android NDK, as below.
If a device implementation includes support for an Android ABI, it:
Note that future releases of the Android NDK may introduce support for additional ABIs. If a device implementation is not compatible with an existing predefined ABI, it MUST NOT report support for any ABIs at all.
The following native code APIs MUST be available to apps that include native code:
For the native libraries listed above, the device implementation MUST NOT add or remove the public functions.
Native libraries not listed above but implemented and provided in AOSP as system libraries are reserved and MUST NOT be exposed to third-party apps targeting API level 24 or higher.
Device implementations MAY add non-AOSP libraries and expose them directly as an API to third-party apps but the additional libraries SHOULD be in /vendor/lib
or /vendor/lib64
and MUST be listed in /vendor/etc/public.libraries.txt
.
Note that device implementations MUST include libGLESv3.so and in turn, MUST export all the OpenGL ES 3.1 and Android Extension Pack function symbols as defined in the NDK release android-24. Although all the symbols must be present, only the corresponding functions for OpenGL ES versions and extensions actually supported by the device must be fully implemented.
Vulkan is a low-overhead, cross-platform API for high-performance 3D graphics. Device implementations, even if not including support of the Vulkan APIs, MUST satisfy the following requirements:
libvulkan.so
which exports function symbols for the core Vulkan 1.0 API as well as the VK_KHR_surface
, VK_KHR_android_surface
, and VK_KHR_swapchain
extensions.Device implementations, if including support of the Vulkan APIs:
VkPhysicalDevices
through the vkEnumeratePhysicalDevices
call.VkPhysicalDevices
MUST fully implement the Vulkan 1.0 API.PackageManager#FEATURE_VULKAN_HARDWARE_LEVEL
and PackageManager#FEATURE_VULKAN_HARDWARE_VERSION
feature flags.libVkLayer*.so
in the application package’s native library directory, through the vkEnumerateInstanceLayerProperties
and vkEnumerateDeviceLayerProperties
functions in libvulkan.so
android:debuggable=”true”
attribute.Device implementations, if not including support of the Vulkan APIs:
VkPhysicalDevices
through the vkEnumeratePhysicalDevices
call.PackageManager#FEATURE_VULKAN_HARDWARE_LEVEL
and PackageManager#FEATURE_VULKAN_HARDWARE_VERSION
.The ARMv8 architecture deprecates several CPU operations, including some operations used in existing native code. On 64-bit ARM devices, the following deprecated operations MUST remain available to 32-bit native ARM code, either through native CPU support or through software emulation:
Legacy versions of the Android NDK used /proc/cpuinfo to discover CPU features from 32-bit ARM native code. For compatibility with applications built using this NDK, devices MUST include the following lines in /proc/cpuinfo when it is read by 32-bit ARM applications:
These requirements only apply when /proc/cpuinfo is read by 32-bit ARM applications. Devices SHOULD not alter /proc/cpuinfo when read by 64-bit ARM or non-ARM applications.