Vulkan SDK for Android 1.1.1 Mali Developer Center
Building The Samples

Shows how to build the Vulkan samples included in the Vulkan SDK for Android.

It is assumed that you have set up Android Studio and NDK appropriately as mentioned in the Getting Started Guide.

Building samples in Android Studio

Make sure you have checked out submodules before building.

git submodule init
git submodule update
  1. Open Android Studio 2.2 or newer
  2. Open an existing Android Studio project
  3. Import a sample project, for example samples/hellotriangle
  4. You might be prompted to update or install the Gradle wrapper. Do so if asked.
  5. You might be prompted to download and/or update Android SDK tools if Android Studio has not downloaded these before
  6. Under Tools -> Android -> SDK manager, install cmake, lldb and NDK components.
  7. In the top menu, run Build -> Make Project
  8. In the bottom of the screen, the Messages tab should display a build log which shows that libnative.so has been built and that build was successful
  9. Run the app on the device by pressing the Play button on the top toolbar
  10. To debug the code, Run -> Debug app. In the project view, you will find app/cpp/native/hellotriangle.cpp or similar. You can set breakpoints and step through the code.

Building samples for ARM Linux and Linux desktop

It is possible to build samples to run on ARM Linux or Linux desktop. shaderc (binary name: glslc) must be installed on your system to build shaders to SPIR-V.

git submodule init
git submodule update
mkdir build
cd build
# For desktop Linux
cmake .. -DPLATFORM=xcb -DTESTS:BOOL=ON
# For ARMv7 hardfloat Linux
cmake .. -DPLATFORM=display -DTESTS:BOOL=ON -DCMAKE_TOOLCHAIN_FILE=../toolchains/armhf.cmake
# Other platforms include wayland, xcb, png (default).
make -j8
ctest # Runs all samples for a few seconds.