}
/**
+ * Displays the ABIs valid for the given target.
+ */
+ private void displayAbiList(IAndroidTarget target, String message) {
+ String[] abis = target.getAbiList();
+ mSdkLog.printf(message);
+ if (abis != null) {
+ boolean first = true;
+ for (String skin : abis) {
+ if (first == false) {
+ mSdkLog.printf(", ");
+ } else {
+ first = false;
+ }
+ mSdkLog.printf(skin);
+ }
+ mSdkLog.printf("\n");
+ } else {
+ mSdkLog.printf("no ABIs.\n");
+ }
+ }
+
+ /**
* Displays the list of available AVDs for the given AvdManager.
*
* @param avdManager
oldAvdInfo = avdManager.getAvd(avdName, false /*validAvdOnly*/);
}
- // NOTE: need to update with command line processor selectivity
+ String abiType = mSdkCommandLine.getParamAbi();
+ if (target != null && (abiType == null || abiType.length() == 0)) {
+ String[] abis = target.getAbiList();
+ if (abis != null && abis.length == 1) {
+ // Auto-select the single ABI available
+ abiType = abis[0];
+ 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);
+
+ }
+ }
- String preferredAbi = SdkConstants.ABI_ARMEABI;
@SuppressWarnings("unused") // newAvdInfo is never read, yet useful for debugging
AvdInfo newAvdInfo = avdManager.createAvd(avdFolder,
avdName,
target,
- preferredAbi,
+ abiType,
skin,
mSdkCommandLine.getParamSdCard(),
hardwareConfig,
public static final String KEY_SNAPSHOT = "snapshot"; //$NON-NLS-1$
public static final String KEY_COMPACT = "compact"; //$NON-NLS-1$
public static final String KEY_EOL_NULL = "null"; //$NON-NLS-1$
+ public static final String KEY_ABI = "abi"; //$NON-NLS-1$
/**
* Action definitions for SdkManager command line.
define(Mode.BOOLEAN, false,
VERB_CREATE, OBJECT_AVD, "a", KEY_SNAPSHOT, //$NON-NLS-1$
"Place a snapshots file in the AVD, to enable persistence.", false);
+ define(Mode.STRING, false,
+ VERB_CREATE, OBJECT_AVD, "b", KEY_ABI, //$NON-NLS-1$
+ "The ABI to use for the AVD. The default is to auto-select the ABI if the platform has only one ABI for its system images.",
+ null);
// --- delete avd ---
return ((String) getValue(null, null, KEY_FILTER));
}
+ /** Helper to retrieve the --abi value. */
+ public String getParamAbi() {
+ return ((String) getValue(null, null, KEY_ABI));
+ }
+
/** Helper to retrieve the --proxy-host value. */
public String getParamProxyHost() {
return ((String) getValue(null, null, KEY_PROXY_HOST));
File userdataSrc = new File(imagePath, USERDATA_IMG);
if (userdataSrc.exists() == false && target.isPlatform() == false) {
- imagePath =
- target.getParent().getImagePath(abiType);
+ imagePath = target.getParent().getImagePath(abiType);
userdataSrc = new File(imagePath, USERDATA_IMG);
}
return null;
}
- /** Copy the nominated file to the given destination.
- * @param source
- * @param destination
+ /**
+ * Copy the nominated file to the given destination.
*
* @throws FileNotFoundException
* @throws IOException