Skip to content

Commit 13aedec

Browse files
committed
Made p4a call sdkmanager instead of android if present in SDK
1 parent 92ee1a8 commit 13aedec

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pythonforandroid/build.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,15 @@ def prepare_build_environment(self, user_sdk_dir, user_ndk_dir,
226226
error('You probably want to build with --arch=armeabi-v7a instead')
227227
exit(1)
228228

229-
android = sh.Command(join(sdk_dir, 'tools', 'android'))
230-
targets = android('list').stdout.decode('utf-8').split('\n')
229+
if exists(join(sdk_dir, 'tools', 'android')):
230+
android = sh.Command(join(sdk_dir, 'tools', 'android'))
231+
targets = android('list').stdout.decode('utf-8').split('\n')
232+
elif exists(join(sdk_dir, 'bin', 'avdmanager')):
233+
avdmanager = sh.Command(join(sdk_dir, 'bin', 'avdmanager'))
234+
targets = avdmanager('list', 'target').stdout.decode('utf-8').split('\n')
235+
else:
236+
error('Could not find `android` or `sdkmanager` binaries in '
237+
'Android SDK. Exiting.')
231238
apis = [s for s in targets if re.match(r'^ *API level: ', s)]
232239
apis = [re.findall(r'[0-9]+', s) for s in apis]
233240
apis = [int(s[0]) for s in apis if s]

0 commit comments

Comments
 (0)