Skip to content

Android NDK support in CMake 3.16 broken by NDK r22

The support for Android NDK is totally broken:

set(CMAKE_SYSTEM_NAME Android)
set(CMAKE_SYSTEM_VERSION 29)
set(CMAKE_ANDROID_ARCH_ABI aarch64)
set(CMAKE_ANDROID_NDK "/home/X/Android/Sdk")

I have already installed the NDK V22 from the Android Studio (there are no other versions available). When this code is ran before any other cmake code we get:

CMake Error at /usr/share/cmake-3.16/Modules/Platform/Android-Initialize.cmake:40 (message):
  Android: The system root directory needed for the selected Android version
  and architecture does not exist:

Which is normal considering the wrong directory structure CMake expects. It appears CMake is trying to locate a folder called arch-arm under android-29 folder. The android-29 folder exists however the arch-arm folder does not exist and yet CMake thinks it should. Why?

If that error is "by design", then why keep a code that basically does not work at all?

Edited by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information