@@ -180,9 +180,9 @@ protected boolean badness() {
180
180
return false ;
181
181
}
182
182
183
-
184
- protected boolean create (final AndroidSDK sdk ) throws IOException {
185
-
183
+
184
+ protected void initTargets (final AndroidSDK sdk ) throws IOException {
185
+ preferredAbi . clear ();
186
186
final String [] list_abi = {
187
187
sdk .getAndroidToolPath (),
188
188
"list" , "targets"
@@ -213,6 +213,7 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
213
213
214
214
if (api != null && abis != null ) {
215
215
for (String abi : abis ) {
216
+ if (abiList .indexOf (abi ) == -1 ) continue ;
216
217
if (preferredAbi .get (api ) == null ) {
217
218
preferredAbi .put (api , abi );
218
219
} else if (abiList .indexOf (preferredAbi .get (api )) < abiList .indexOf (abi )) {
@@ -243,7 +244,18 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
243
244
// }
244
245
// }
245
246
}
246
- } catch (InterruptedException e ) {}
247
+ } catch (InterruptedException e ) {}
248
+ }
249
+
250
+
251
+ protected boolean noTargets (final AndroidSDK sdk ) throws IOException {
252
+ initTargets (sdk );
253
+ return preferredAbi .size () == 0 ;
254
+ }
255
+
256
+
257
+ protected boolean create (final AndroidSDK sdk ) throws IOException {
258
+ initTargets (sdk );
247
259
248
260
final String [] params = {
249
261
sdk .getAndroidToolPath (),
@@ -261,7 +273,7 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
261
273
// Set the list to null so that exists() will check again
262
274
avdList = null ;
263
275
264
- p = new ProcessHelper (params );
276
+ ProcessHelper p = new ProcessHelper (params );
265
277
try {
266
278
// Passes 'no' to "Do you wish to create a custom hardware profile [no]"
267
279
final ProcessResult createAvdResult = p .execute ("no" );
@@ -286,19 +298,21 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
286
298
287
299
static public boolean ensureProperAVD (final Frame window , final AndroidMode mode ,
288
300
final AndroidSDK sdk ) {
289
- try {
290
-
301
+ try {
291
302
if (AndroidBuild .appComponent == AndroidBuild .WATCHFACE ) {
292
303
if (wearAVD .exists (sdk )) {
293
304
return true ;
294
305
}
295
306
if (wearAVD .badness ()) {
307
+ Messages .showWarningTiered ("Android Error" , AVD_LOAD_PRIMARY , AVD_LOAD_SECONDARY , null );
308
+ return false ;
309
+ }
310
+ if (wearAVD .noTargets (sdk )) {
296
311
boolean res = AndroidSDK .locateSysImage (window , mode , true );
297
312
if (!res ) {
298
- Messages .showWarningTiered ("Android Error" , AVD_LOAD_PRIMARY , AVD_LOAD_SECONDARY , null );
299
- return false ;
313
+ return false ;
300
314
}
301
- }
315
+ }
302
316
if (wearAVD .create (sdk )) {
303
317
return true ;
304
318
}
@@ -307,17 +321,19 @@ static public boolean ensureProperAVD(final Frame window, final AndroidMode mode
307
321
return true ;
308
322
}
309
323
if (defaultAVD .badness ()) {
324
+ Messages .showWarningTiered ("Android Error" , AVD_LOAD_PRIMARY , AVD_LOAD_SECONDARY , null );
325
+ return false ;
326
+ }
327
+ if (defaultAVD .noTargets (sdk )) {
310
328
boolean res = AndroidSDK .locateSysImage (window , mode , false );
311
329
if (!res ) {
312
- Messages .showWarningTiered ("Android Error" , AVD_LOAD_PRIMARY , AVD_LOAD_SECONDARY , null );
313
- return false ;
330
+ return false ;
314
331
}
315
- }
332
+ }
316
333
if (defaultAVD .create (sdk )) {
317
334
return true ;
318
335
}
319
336
}
320
-
321
337
} catch (final Exception e ) {
322
338
Messages .showWarningTiered ("Android Error" , AVD_CREATE_PRIMARY ,
323
339
String .format (AVD_CREATE_SECONDARY ,
0 commit comments