4444# because it doesn't seem to matter much, it is normally correct to
4545# download once then update all the components as buildozer already
4646# does.
47- DEFAULT_SDK_TAG = '4333796 '
47+ DEFAULT_SDK_TAG = '6514223 '
4848
4949DEFAULT_ARCH = 'armeabi-v7a'
5050
@@ -159,8 +159,11 @@ def p4a_recommended_android_ndk(self):
159159 def _sdkmanager (self , * args , ** kwargs ):
160160 """Call the sdkmanager in our Android SDK with the given arguments."""
161161 # Use the android-sdk dir as cwd by default
162- kwargs ['cwd' ] = kwargs .get ('cwd' , self .android_sdk_dir )
163- command = self .sdkmanager_path + ' ' + ' ' .join (args )
162+ android_sdk_dir = self .android_sdk_dir
163+ kwargs ['cwd' ] = kwargs .get ('cwd' , android_sdk_dir )
164+ sdkmanager_path = self .sdkmanager_path
165+ sdk_root = f"--sdk_root={ android_sdk_dir } "
166+ command = f"{ sdkmanager_path } { sdk_root } " + ' ' .join (args )
164167 return_child = kwargs .pop ('return_child' , False )
165168 if return_child :
166169 return self .buildozer .cmd_expect (command , ** kwargs )
@@ -372,18 +375,18 @@ def _install_android_sdk(self):
372375
373376 self .buildozer .info ('Android SDK is missing, downloading' )
374377 if platform in ('win32' , 'cygwin' ):
375- archive = 'sdk-tools-windows-{} .zip' .format (DEFAULT_SDK_TAG )
378+ archive = 'commandlinetools-win-{}_latest .zip' .format (DEFAULT_SDK_TAG )
376379 elif platform in ('darwin' , ):
377- archive = 'sdk-tools-darwin-{} .zip' .format (DEFAULT_SDK_TAG )
380+ archive = 'commandlinetools-mac-{}_latest .zip' .format (DEFAULT_SDK_TAG )
378381 elif platform .startswith ('linux' ):
379- archive = 'sdk-tools- linux-{}.zip' .format (DEFAULT_SDK_TAG )
382+ archive = 'commandlinetools- linux-{}_latest .zip' .format (DEFAULT_SDK_TAG )
380383 else :
381384 raise SystemError ('Unsupported platform: {0}' .format (platform ))
382385
383386 if not os .path .exists (sdk_dir ):
384387 os .makedirs (sdk_dir )
385388
386- url = 'http ://dl.google.com/android/repository/'
389+ url = 'https ://dl.google.com/android/repository/'
387390 self .buildozer .download (url ,
388391 archive ,
389392 cwd = sdk_dir )
@@ -524,8 +527,10 @@ def _android_update_sdk(self, *sdkmanager_commands):
524527 # This leads to a stderr "Broken pipe" message which is harmless,
525528 # but doesn't look good on terminal, hence redirecting to /dev/null
526529 yes_command = 'yes 2>/dev/null'
527- command = '{} | {} --licenses' .format (
528- yes_command , self .sdkmanager_path )
530+ android_sdk_dir = self .android_sdk_dir
531+ sdkmanager_path = self .sdkmanager_path
532+ sdk_root = f"--sdk_root={ android_sdk_dir } "
533+ command = f"{ yes_command } | { sdkmanager_path } { sdk_root } --licenses"
529534 self .buildozer .cmd (command , cwd = self .android_sdk_dir )
530535 else :
531536 kwargs ['show_output' ] = True
@@ -573,7 +578,7 @@ def _install_android_packages(self):
573578 if self .buildozer .state .get (cache_key , None ) == cache_value :
574579 return True
575580
576- # 1. update the tool and platform-tools if needed
581+ # 1. update the platform-tools package if needed
577582
578583 skip_upd = self .buildozer .config .getbooldefault (
579584 'app' , 'android.skip_update' , False )
@@ -582,7 +587,7 @@ def _install_android_packages(self):
582587 self .buildozer .info ('Installing/updating SDK platform tools if necessary' )
583588
584589 # just calling sdkmanager with the items will install them if necessary
585- self ._android_update_sdk ('tools' , ' platform-tools' )
590+ self ._android_update_sdk ('platform-tools' )
586591 self ._android_update_sdk ('--update' )
587592 else :
588593 self .buildozer .info ('Skipping Android SDK update due to spec file setting' )
0 commit comments