24
24
import processing .app .Base ;
25
25
import processing .app .Platform ;
26
26
import processing .app .Preferences ;
27
- import processing .app .exec .LineProcessor ;
28
27
import processing .app .exec .StreamPump ;
29
28
import processing .core .PApplet ;
30
29
@@ -353,6 +352,16 @@ protected String getSdkId() throws IOException {
353
352
return "null" ;
354
353
}
355
354
355
+ protected void copyDeviceSkins (final AndroidSDK sdk , final AndroidMode mode ) {
356
+ File skinsFolder = new File (sdk .getFolder (), "skins" );
357
+ if (!skinsFolder .exists ()) {
358
+ // The skins in this folder come from Android Studio, on Mac they are in the folder:
359
+ // /Applications/Android Studio.app/Contents/plugins/android/resources/device-art-resources
360
+ // Apparently the skins are not available as a SDK download.
361
+ File artFolder = new File (mode .getResourcesFolder (), "device-art-resources" );
362
+ AndroidUtil .copyDir (artFolder , skinsFolder );
363
+ }
364
+ }
356
365
357
366
protected boolean create (final AndroidSDK sdk ) throws IOException {
358
367
File sketchbookFolder = processing .app .Base .getSketchbookFolder ();
@@ -379,9 +388,8 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
379
388
}
380
389
381
390
// avdmanager create avd -n "Wear-Processing-0254" -k "system-images;android-25;google_apis;x86" -c 64M
382
-
383
391
// Set the list to null so that exists() will check again
384
- avdList = null ;
392
+ // avdList = null;
385
393
386
394
Map <String , String > env = pb .environment ();
387
395
env .clear ();
@@ -392,13 +400,13 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
392
400
process = pb .start ();
393
401
394
402
// Passes 'no' to "Do you wish to create a custom hardware profile [no]"
395
- OutputStream os = process .getOutputStream ();
396
- PrintWriter pw = new PrintWriter (new OutputStreamWriter (os ));
397
- pw .println ("no" );
398
- pw .flush ();
399
- pw .close ();
400
- os .flush ();
401
- os .close ();
403
+ // OutputStream os = process.getOutputStream();
404
+ // PrintWriter pw = new PrintWriter(new OutputStreamWriter(os));
405
+ // pw.println("no");
406
+ // pw.flush();
407
+ // pw.close();
408
+ // os.flush();
409
+ // os.close();
402
410
403
411
StringWriter outWriter = new StringWriter ();
404
412
new StreamPump (process .getInputStream (), "out: " ).addTarget (outWriter ).start ();
@@ -427,7 +435,6 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
427
435
AndroidMode .getTextString ("android_avd.error.cannot_create_avd_body" , AndroidBuild .TARGET_SDK ));
428
436
}
429
437
System .err .println (outWriter .toString ());
430
- //System.err.println(createAvdResult);
431
438
} catch (final InterruptedException ie ) {
432
439
ie .printStackTrace ();
433
440
} finally {
@@ -463,6 +470,7 @@ static public boolean ensureProperAVD(final Frame window, final AndroidMode mode
463
470
avd .refreshImages (sdk );
464
471
}
465
472
}
473
+ avd .copyDeviceSkins (sdk , mode );
466
474
if (avd .create (sdk )) {
467
475
return true ;
468
476
}
0 commit comments