OSDN Git Service

When creating AVDs, check ABI before prompting for hw config.
authorXavier Ducrohet <xav@android.com>
Fri, 23 Sep 2011 22:24:47 +0000 (15:24 -0700)
committerXavier Ducrohet <xav@android.com>
Fri, 23 Sep 2011 22:24:47 +0000 (15:24 -0700)
The check verifies the number of available ABIs and the presence
of the --abi option (required if 2+ ABIs).

This avoid going through all the hardware config to then get an error
because --abi is missing.

Change-Id: I64fefc73f4cb3d9a420309ad1850fa6c30f70e0d

sdkmanager/app/src/com/android/sdkmanager/Main.java

index 780a821..4e5c0fb 100644 (file)
@@ -1067,6 +1067,20 @@ public class Main {
                 }
             }
 
+            String abiType = mSdkCommandLine.getParamAbi();
+            if (target != null && (abiType == null || abiType.length() == 0)) {
+                ISystemImage[] systemImages = target.getSystemImages();
+                if (systemImages != null && systemImages.length == 1) {
+                    // Auto-select the single ABI available
+                    abiType = systemImages[0].getAbiType();
+                    mSdkLog.printf("Auto-selecting single ABI %1$s", abiType);
+                } else {
+                    displayAbiList(target, "Valid ABIs: ");
+                    errorAndExit("This platform has more than one ABI. Please specify one using --%1$s.",
+                            SdkCommandLine.KEY_ABI);
+                }
+            }
+
             Map<String, String> hardwareConfig = null;
             if (target != null && target.isPlatform()) {
                 try {
@@ -1082,20 +1096,6 @@ public class Main {
                 oldAvdInfo = avdManager.getAvd(avdName, false /*validAvdOnly*/);
             }
 
-            String abiType = mSdkCommandLine.getParamAbi();
-            if (target != null && (abiType == null || abiType.length() == 0)) {
-                ISystemImage[] systemImages = target.getSystemImages();
-                if (systemImages != null && systemImages.length == 1) {
-                    // Auto-select the single ABI available
-                    abiType = systemImages[0].getAbiType();
-                    mSdkLog.printf("Auto-selecting single ABI %1$s", abiType);
-                } else {
-                    displayAbiList(target, "Valid ABIs: ");
-                    errorAndExit("This platform has more than one ABI. Please specify one using --%1$s.",
-                            SdkCommandLine.KEY_ABI);
-                }
-            }
-
             @SuppressWarnings("unused") // newAvdInfo is never read, yet useful for debugging
             AvdInfo newAvdInfo = avdManager.createAvd(avdFolder,
                     avdName,