diff --git a/configure.py b/configure.py index 262637734a5..99aa1d6edfa 100644 --- a/configure.py +++ b/configure.py @@ -17,6 +17,7 @@ import argparse import errno import glob +import json import os import platform import re @@ -36,7 +37,7 @@ _DEFAULT_TENSORRT_VERSION = '6' _DEFAULT_CUDA_COMPUTE_CAPABILITIES = '3.5,7.0' _SUPPORTED_ANDROID_NDK_VERSIONS = [ - 19, 20, 21 + 19, 20, 21, 22, 23, 24, 25 ] _DEFAULT_PROMPT_ASK_ATTEMPTS = 10 @@ -748,16 +749,11 @@ def get_ndk_api_level(environ_cp, android_ndk_home_path): # Now grab the NDK API level to use. Note that this is different from the # SDK API level, as the NDK API level is effectively the *min* target SDK # version. - platforms = os.path.join(android_ndk_home_path, 'platforms') - api_levels = sorted(os.listdir(platforms)) - api_levels = [ - x.replace('android-', '') for x in api_levels if 'android-' in x - ] - - def valid_api_level(api_level): - return os.path.exists( - os.path.join(android_ndk_home_path, 'platforms', 'android-' + api_level) - ) + meta = open(os.path.join(android_ndk_home_path, 'meta/platforms.json')) + platforms = json.load(meta) + meta.close + aliases = platforms['aliases'] + api_levels = sorted(list(set([ aliases[i] for i in aliases ]))) android_ndk_api_level = prompt_loop_or_load_from_env( environ_cp, @@ -768,7 +764,7 @@ def get_ndk_api_level(environ_cp, android_ndk_home_path): '[Available levels: %s]' ) % api_levels, - check_success=valid_api_level, + check_success=(lambda *_: True), error_msg='Android-%s is not present in the NDK path.', )