use of com.wuntee.oter.exception.GenericException in project otertool by wuntee.
the class AvdWorkshop method createAvd.
public static AvdInfo createAvd(CreateAvdBean bean) throws AndroidLocationException, IOException, GenericException {
ISdkLog sdkLogger = AvdWorkshop.getAvdLogger();
SdkManager sdkManager = SdkManager.createManager(OterStatics.getAndroidHome(), sdkLogger);
AvdManager avdManager = new AvdManager(sdkManager, sdkLogger);
File avdFolder = new File(AndroidLocation.getFolder() + "avd", bean.getName() + ".avd");
//newAvdInfo = avdManager.createAvd(avdFolder, avdName, target, skin, this.mSdkCommandLine.getParamSdCard(), hardwareConfig, removePrevious, this.mSdkCommandLine.getFlagSnapshot(), this.mSdkLog);
IAndroidTarget target = getAndroidTargetFromString(sdkManager, bean.getTarget());
ISystemImage[] abiTypes = target.getSystemImages();
if (abiTypes.length == 0) {
throw new GenericException("There are no images associated with the target.");
}
//ABI = Android Base Image ?
String abiType = abiTypes[0].getAbiType();
// /Applications/android-sdk-macosx/system-images/android-15/armeabi-v7a//system.img
// avdManager. createAvd(avdFolder, avdName, avdTarget, ABI, skin, sdCard, hadwareConfig, snapshot, force, false, logger)
//AvdInfo ret = avdManager.createAvd(avdFolder, bean.getName(), target, null, null, null, false, false, sdkLogger);
// createAvd(File arg0, String arg1, IAndroidTarget arg2, String arg3, String arg4, Map<String, String> arg5, boolean arg6, boolean arg7, ISdkLog arg8)
AvdInfo ret = avdManager.createAvd(avdFolder, bean.getName(), target, abiType, null, null, null, false, false, false, sdkLogger);
if (ret == null) {
logger.error("There was an error createing AVD, the manager returned a null info object.");
throw new GenericException("Could not create AVD for an unknown reason.");
}
if (bean.isPersistant() == true) {
makeAvdPersistant(ret);
}
return (ret);
}
Aggregations