Skip to content

Commit efc47f0

Browse files
committed
Added back the option to download system images
1 parent 68dd4e0 commit efc47f0

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

src/processing/mode/android/AVD.java

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public class AVD {
7373
/** "android-7" or "Google Inc.:Google APIs:7" */
7474
protected String sdkId;
7575

76+
static boolean invalidPackage;
7677
static ArrayList<String> avdList;
7778
static ArrayList<String> badList;
7879
// static ArrayList<String> skinList;
@@ -317,7 +318,8 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
317318
}
318319
if (output.toString().contains("Package path is not valid")) {
319320
// They didn't install the Google APIs
320-
AndroidUtil.showMessage(AVD_TARGET_TITLE, AVD_TARGET_MESSAGE);
321+
//AndroidUtil.showMessage(AVD_TARGET_TITLE, AVD_TARGET_MESSAGE);
322+
invalidPackage = true;
321323
} else {
322324
// Just generally not working
323325
AndroidUtil.showMessage(AVD_CREATE_TITLE,
@@ -353,15 +355,20 @@ static public boolean ensureProperAVD(final Frame window, final AndroidMode mode
353355
AndroidUtil.showMessage(AVD_LOAD_TITLE, AVD_LOAD_MESSAGE);
354356
return false;
355357
}
356-
// if (wearAVD.noTargets(sdk)) {
357-
// boolean res = AndroidSDK.locateSysImage(window, mode, true);
358-
// if (!res) {
359-
// return false;
360-
// }
361-
// }
362358
if (wearAVD.create(sdk)) {
363359
return true;
364-
}
360+
}
361+
if (invalidPackage) {
362+
boolean res = AndroidSDK.locateSysImage(window, mode, true);
363+
if (!res) {
364+
return false;
365+
} else {
366+
// Try again
367+
if (wearAVD.create(sdk)) {
368+
return true;
369+
}
370+
}
371+
}
365372
} else {
366373
if (mobileAVD.exists(sdk)) {
367374
return true;
@@ -370,15 +377,20 @@ static public boolean ensureProperAVD(final Frame window, final AndroidMode mode
370377
AndroidUtil.showMessage(AVD_LOAD_TITLE, AVD_LOAD_MESSAGE);
371378
return false;
372379
}
373-
// if (mobileAVD.noTargets(sdk)) {
374-
// boolean res = AndroidSDK.locateSysImage(window, mode, false);
375-
// if (!res) {
376-
// return false;
377-
// }
378-
// }
379380
if (mobileAVD.create(sdk)) {
380381
return true;
381382
}
383+
if (invalidPackage) {
384+
boolean res = AndroidSDK.locateSysImage(window, mode, false);
385+
if (!res) {
386+
return false;
387+
} else {
388+
// Try again
389+
if (mobileAVD.create(sdk)) {
390+
return true;
391+
}
392+
}
393+
}
382394
}
383395
} catch (final Exception e) {
384396
e.printStackTrace();

0 commit comments

Comments
 (0)