@@ -138,9 +138,9 @@ static public String getPreferredPort(boolean wear) {
138
138
static protected String getPreferredTag (boolean wear , String abi ) {
139
139
if (wear ) {
140
140
return "android-wear" ;
141
- } else if (abi .contains ("arm" )) {
142
- // The ARM images are located in the default folder.
143
- return "default" ;
141
+ // } else if (abi.contains("arm")) {
142
+ // // The ARM images are located in the default folder. No, apparently ARM images are in google_apis too
143
+ // return "default";
144
144
} else {
145
145
return "google_apis" ;
146
146
}
@@ -299,10 +299,10 @@ protected void getImages(final ArrayList<String> images, final AndroidSDK sdk,
299
299
"create" , "avd" ,
300
300
"-n" , "dummy" ,
301
301
"-k" , "dummy"
302
- };
303
-
304
- // Dummy avdmanager creation command to get the list of installed images
305
- // TODO : Find a better way to get the list of installed images
302
+ };
303
+
304
+ // Dummy avdmanager creation command to get the list of installed images,
305
+ // so far this is the only method available get that list.
306
306
ProcessBuilder pb = new ProcessBuilder (cmd );
307
307
308
308
if (Base .DEBUG ) {
@@ -316,23 +316,21 @@ protected void getImages(final ArrayList<String> images, final AndroidSDK sdk,
316
316
317
317
try {
318
318
process = pb .start ();
319
+ StringWriter outWriter = new StringWriter ();
320
+ new StreamPump (process .getInputStream (), "out: " ).addTarget (outWriter ).start ();
321
+ process .waitFor ();
319
322
320
- StreamPump output = new StreamPump (process .getInputStream (), "out: " );
321
- output .addTarget (new LineProcessor () {
322
- @ Override
323
- public void processLine (String line ) {
324
- // System.out.println("dummy output ---> " + line);
325
- if (images != null &&
326
- line .contains (";" + imagePlatform ) &&
327
- line .contains (";" + imageTag ) &&
328
- line .contains (";" + imageAbi )) {
323
+ String [] lines = PApplet .split (outWriter .toString (), '\n' );
324
+ for (String line : lines ) {
325
+ if (images != null &&
326
+ line .contains (";" + imagePlatform ) &&
327
+ line .contains (";" + imageTag ) &&
328
+ line .contains (";" + imageAbi )) {
329
329
// System.out.println(" added image!");
330
- images .add (line );
331
- }
330
+ images .add (line );
332
331
}
333
- }). start ();
332
+ }
334
333
335
- process .waitFor ();
336
334
} catch (final InterruptedException ie ) {
337
335
ie .printStackTrace ();
338
336
} finally {
@@ -370,7 +368,7 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
370
368
avdManager .getCanonicalPath (),
371
369
"create" , "avd" ,
372
370
"-n" , name ,
373
- "-k" , getSdkId (),
371
+ "-k" , " \" " + getSdkId () + " \" " ,
374
372
"-c" , DEFAULT_SDCARD_SIZE ,
375
373
"-d" , device ,
376
374
"-p" , avdPath .getAbsolutePath (),
0 commit comments