conan.tools.android

android_abi()

android_abi(conanfile, context=’host’)

Returns Android-NDK ABI

  • Parameters:

    • conanfile – ConanFile instance

    • context – either “host”, “build” or “target”

    Returns:

    Android-NDK ABI

This function might not be necessary when using Conan built-in integrations, as they already manage it, but can be useful if developing your own build system integration.

android_abi() function returns the Android standard ABI name based on Conan settings.arch value, something like:

  1. def android_abi(conanfile, context="host"):
  2. ...
  3. return {
  4. "armv5el": "armeabi",
  5. "armv5hf": "armeabi",
  6. "armv5": "armeabi",
  7. "armv6": "armeabi-v6",
  8. "armv7": "armeabi-v7a",
  9. "armv7hf": "armeabi-v7a",
  10. "armv8": "arm64-v8a",
  11. }.get(conanfile.settings.arch)

As it can be seen, the default is the “host” ABI, but it is possible to select also the “build” or “target” ones if necessary.

  1. from conan.tools.android import android_abi
  2. class Pkg(ConanFile):
  3. def generate(self)
  4. abi = android_abi(self)