From 6695fa90193497ad6668abe04b6d68b11958848a Mon Sep 17 00:00:00 2001 From: Ruben Di Battista Date: Fri, 10 Apr 2020 03:06:23 +0200 Subject: [PATCH] Add --sdk_root arg to sdkmanager Avoid problems when instead of fully fledged Android Studio you're using just the Command Line Tools https://stackoverflow.com/q/60440509/1334711 --- buildozer/targets/android.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index 94f37a941..43a381c61 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -159,6 +159,8 @@ def p4a_recommended_android_ndk(self): def _sdkmanager(self, *args, **kwargs): """Call the sdkmanager in our Android SDK with the given arguments.""" + # Add --sdk_root to account for Android command line tools bug + args += (f"--sdk_root={self.android_sdk_dir}",) # Use the android-sdk dir as cwd by default kwargs['cwd'] = kwargs.get('cwd', self.android_sdk_dir) command = self.sdkmanager_path + ' ' + ' '.join(args) @@ -530,8 +532,9 @@ def _android_update_sdk(self, *sdkmanager_commands): # This leads to a stderr "Broken pipe" message which is harmless, # but doesn't look good on terminal, hence redirecting to /dev/null yes_command = 'yes 2>/dev/null' - command = '{} | {} --licenses'.format( - yes_command, self.sdkmanager_path) + command = "{} | {} --licenses --sdk_root={}".format( + yes_command, self.sdkmanager_path, self.android_sdk_dir + ) self.buildozer.cmd(command, cwd=self.android_sdk_dir) else: kwargs['show_output'] = True