Skip to content

Commit 5e0c22c

Browse files
[FIX] Locate SDK-Check for any platform > 26
1 parent 1abe67d commit 5e0c22c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,14 @@ public AndroidSDK(File folder) throws BadSDKException, IOException {
117117
if (!platforms.exists()) {
118118
throw new BadSDKException(AndroidMode.getTextString("android_sdk.error.missing_platforms_folder", folder));
119119
}
120-
121-
targetPlatform = new File(platforms, AndroidBuild.TARGET_PLATFORM);
120+
121+
String[] availPlatforms = platforms.list();
122+
int maxVersion = 26;
123+
for (String availPlatform:availPlatforms){
124+
int platformVersion = Integer.parseInt(availPlatform.substring(availPlatform.length()-2));
125+
if (platformVersion > maxVersion) maxVersion = platformVersion;
126+
}
127+
targetPlatform = new File(platforms, "android-"+maxVersion);
122128
if (!targetPlatform.exists()) {
123129
throw new BadSDKException(AndroidMode.getTextString("android_sdk.error.missing_target_platform",
124130
AndroidBuild.TARGET_SDK, platforms.getAbsolutePath()));
@@ -133,6 +139,8 @@ public AndroidSDK(File folder) throws BadSDKException, IOException {
133139
avdManager = findCliTool(new File(tools, "bin"), "avdmanager");
134140
sdkManager = findCliTool(new File(tools, "bin"), "sdkmanager");
135141

142+
Preferences.set("android.sdk.target",maxVersion+"");
143+
136144
String path = Platform.getenv("PATH");
137145

138146
Platform.setenv("ANDROID_SDK", folder.getCanonicalPath());

0 commit comments

Comments
 (0)