@@ -102,13 +102,19 @@ public AndroidSDK(File folder) throws BadSDKException, IOException {
102102 throw new BadSDKException (AndroidMode .getTextString ("android_sdk.error.missing_sdk_folder" , folder ));
103103 }
104104
105- File tmp = new File (folder , "cmdline-tools/latest" );
106- if (!tmp .exists ()) {
107- tmp = new File (folder , "tools" );
108- } else if (!tmp .exists ()) {
109- throw new BadSDKException (AndroidMode .getTextString ("android_sdk.error.missing_tools_folder" , folder ));
110- }
111- cmdlineTools = tmp ;
105+ File cmdlineTools = new File (folder , "cmdline-tools/latest" );
106+ // we need only command line tools, as sdk/tools got deprecated and can't be used with java 17
107+ if (!cmdlineTools .exists ) {
108+ // lets be more specific to show the error
109+ File sdkTools = new File (folder , "tools" );
110+ if (sdkTools .exists ) {
111+ throw new BadSDKException (AndroidMode .getTextString ("android_sdk.error.missing_cmdtools_folder_found_sdktools" , folder ));
112+ } else {
113+ throw new BadSDKException (AndroidMode .getTextString ("android_sdk.error.missing_cmdtools_folder" , folder ));
114+ }
115+ }
116+ // if we reached here, that means command line tools exists
117+ // ok to go with the command line tools
112118
113119 platformTools = new File (folder , "platform-tools" );
114120 if (!platformTools .exists ()) {
@@ -874,4 +880,4 @@ public CancelException(final String message) {
874880 super (message );
875881 }
876882 }
877- }
883+ }
0 commit comments