@@ -59,10 +59,12 @@ public class AVD {
5959 static private final String AVD_TARGET_SECONDARY =
6060 "Please re-read the installation instructions for Processing<br>" +
6161 "found at http://android.processing.org and try again." ;
62-
63- static final String DEFAULT_SKIN = "WVGA800" ;
62+
6463 static final String DEFAULT_SDCARD_SIZE = "64M" ;
65-
64+
65+ static final String DEFAULT_SKIN = "WVGA800" ;
66+ static final String WEAR_SKIN = "AndroidWearSquare" ;
67+
6668 /** Name of this avd. */
6769 protected String name ;
6870
@@ -74,30 +76,37 @@ public class AVD {
7476// static ArrayList<String> skinList;
7577
7678 private Map <String , String > preferredAbi = new HashMap <>(30 );
77- private static List <String > abiList = new ArrayList <>();
79+ private List <String > abiList = new ArrayList <>();
80+ private String skin ;
7881
7982 /** Default virtual device used by Processing. */
8083 static public final AVD defaultAVD =
8184 new AVD ("Processing-0" + Base .getRevision (),
82- AndroidBuild .target_platform );
85+ AndroidBuild .target_platform , "default" , DEFAULT_SKIN );
8386// "Google Inc.:Google APIs:" + AndroidBuild.sdkVersion);
8487
85- public AVD (final String name , final String target ) {
88+ /** Default virtual wear device used by Processing. */
89+ static public final AVD wearAVD =
90+ new AVD ("Wear-Processing-0" + Base .getRevision (),
91+ AndroidBuild .target_platform , "android-wear" , WEAR_SKIN );
92+
93+ public AVD (final String name , final String target ,
94+ final String tag , final String skin ) {
8695 this .name = name ;
8796 this .target = target ;
88-
89- initializeAbiList ();
97+ this . skin = skin ;
98+ initializeAbiList (tag );
9099 }
91100
92- private void initializeAbiList () {
101+ private void initializeAbiList (String tag ) {
93102 if (abiList .size () == 0 ) {
94103 // The order in this list determines the preference of one abi over the other
95- abiList .add ("default /x86" );
96- abiList .add ("google_apis/x86 " );
97- abiList .add ("default/x86_64 " );
98- abiList .add ("google_apis/x86_64 " );
99- abiList .add ("default/armeabi-v7a " );
100- abiList .add ("google_apis/armeabi-v7a" );
104+ abiList .add (tag + " /x86" );
105+ abiList .add (tag + "/x86_64 " );
106+ abiList .add (tag + "/armeabi-v7a " );
107+ // abiList.add("google_apis/x86 ");
108+ // abiList.add("google_apis/x86_64 ");
109+ // abiList.add("google_apis/armeabi-v7a");
101110 }
102111 }
103112
@@ -241,10 +250,13 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
241250 "-n" , name ,
242251 "-t" , target ,
243252 "-c" , DEFAULT_SDCARD_SIZE ,
244- "-s" , DEFAULT_SKIN ,
253+ "-s" , skin ,
245254 "--abi" , preferredAbi .get (AndroidBuild .target_sdk )
246255 };
247256
257+ //sdk/tools/android create avd -n "Wear-Processing-0254" -t android-23 -c 64M -s AndroidWearSquare --abi android-wear/x86
258+
259+
248260 // Set the list to null so that exists() will check again
249261 avdList = null ;
250262
@@ -273,22 +285,32 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
273285
274286 static public boolean ensureProperAVD (final AndroidSDK sdk ) {
275287 try {
276- if (defaultAVD .exists (sdk )) {
277- // System.out.println("the avd exists");
278- return true ;
279- }
280- // if (badList.contains(defaultAVD)) {
281- if (defaultAVD .badness ()) {
282- // Base.showWarning("Android Error", AVD_CANNOT_LOAD, null);
283- Messages .showWarningTiered ("Android Error" , AVD_LOAD_PRIMARY , AVD_LOAD_SECONDARY , null );
284- return false ;
285- }
286- if (defaultAVD .create (sdk )) {
287- // System.out.println("the avd was created");
288- return true ;
288+
289+ if (AndroidBuild .appComponent == AndroidBuild .WATCHFACE ) {
290+ if (wearAVD .exists (sdk )) {
291+ return true ;
292+ }
293+ if (wearAVD .badness ()) {
294+ Messages .showWarningTiered ("Android Error" , AVD_LOAD_PRIMARY , AVD_LOAD_SECONDARY , null );
295+ return false ;
296+ }
297+ if (wearAVD .create (sdk )) {
298+ return true ;
299+ }
300+ } else {
301+ if (defaultAVD .exists (sdk )) {
302+ return true ;
303+ }
304+ if (defaultAVD .badness ()) {
305+ Messages .showWarningTiered ("Android Error" , AVD_LOAD_PRIMARY , AVD_LOAD_SECONDARY , null );
306+ return false ;
307+ }
308+ if (defaultAVD .create (sdk )) {
309+ return true ;
310+ }
289311 }
312+
290313 } catch (final Exception e ) {
291- // Base.showWarning("Android Error", AVD_CREATE_ERROR, e);
292314 Messages .showWarningTiered ("Android Error" , AVD_CREATE_PRIMARY ,
293315 String .format (AVD_CREATE_SECONDARY ,
294316 AndroidBuild .target_sdk ), null );
0 commit comments