Skip to content

Commit e3f7d5a

Browse files
Update AndroidSDK.java
We can't use `sdk/tools` as these do not support java 17, use `cmdline-tools` only.
1 parent 6792c12 commit e3f7d5a

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

mode/src/processing/mode/android/AndroidSDK.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)