@@ -138,9 +138,9 @@ static public String getPreferredPort(boolean wear) {
138138 static protected String getPreferredTag (boolean wear , String abi ) {
139139 if (wear ) {
140140 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";
144144 } else {
145145 return "google_apis" ;
146146 }
@@ -299,10 +299,10 @@ protected void getImages(final ArrayList<String> images, final AndroidSDK sdk,
299299 "create" , "avd" ,
300300 "-n" , "dummy" ,
301301 "-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.
306306 ProcessBuilder pb = new ProcessBuilder (cmd );
307307
308308 if (Base .DEBUG ) {
@@ -316,23 +316,21 @@ protected void getImages(final ArrayList<String> images, final AndroidSDK sdk,
316316
317317 try {
318318 process = pb .start ();
319+ StringWriter outWriter = new StringWriter ();
320+ new StreamPump (process .getInputStream (), "out: " ).addTarget (outWriter ).start ();
321+ process .waitFor ();
319322
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 )) {
329329// System.out.println(" added image!");
330- images .add (line );
331- }
330+ images .add (line );
332331 }
333- }). start ();
332+ }
334333
335- process .waitFor ();
336334 } catch (final InterruptedException ie ) {
337335 ie .printStackTrace ();
338336 } finally {
@@ -370,7 +368,7 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
370368 avdManager .getCanonicalPath (),
371369 "create" , "avd" ,
372370 "-n" , name ,
373- "-k" , getSdkId (),
371+ "-k" , " \" " + getSdkId () + " \" " ,
374372 "-c" , DEFAULT_SDCARD_SIZE ,
375373 "-d" , device ,
376374 "-p" , avdPath .getAbsolutePath (),
0 commit comments