Skip to content

Commit 8a19206

Browse files
committed
Prefer avdmanager from cmdline-tools
The Android SDK tools are deprecated in favor of the command line tools. Trying to use avdmanager from the deprecated tools fails on OpenJDK 11 with since it can't find the `javax/xml/bind/annotation/XmlSchema` class. Try `cmdline-tools/latest/bin/avdmanager` first. (cherry picked from commit d71ef6a)
1 parent e4467ef commit 8a19206

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pythonforandroid/build.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ def select_and_check_toolchain_version(sdk_dir, ndk_dir, arch, ndk_sysroot_exist
113113

114114

115115
def get_targets(sdk_dir):
116-
if exists(join(sdk_dir, 'tools', 'bin', 'avdmanager')):
116+
if exists(join(sdk_dir, 'cmdline-tools', 'latest', 'bin', 'avdmanager')):
117+
avdmanager = sh.Command(join(sdk_dir, 'cmdline-tools', 'latest', 'bin', 'avdmanager'))
118+
targets = avdmanager('list', 'target').stdout.decode('utf-8').split('\n')
119+
120+
elif exists(join(sdk_dir, 'tools', 'bin', 'avdmanager')):
117121
avdmanager = sh.Command(join(sdk_dir, 'tools', 'bin', 'avdmanager'))
118122
targets = avdmanager('list', 'target').stdout.decode('utf-8').split('\n')
119123
elif exists(join(sdk_dir, 'tools', 'android')):

0 commit comments

Comments
 (0)