use of com.android.sdklib.ISdkLog 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);
}
use of com.android.sdklib.ISdkLog in project otertool by wuntee.
the class CreateAvdDialog method addTargets.
private void addTargets(Combo combo) {
ISdkLog sdkLogger = new ISdkLog() {
public void error(Throwable t, String errorFormat, Object[] args) {
logger.error("Error: ", t);
}
public void warning(String warningFormat, Object[] args) {
logger.warn(args);
}
public void printf(String msgFormat, Object[] args) {
logger.debug(args);
}
};
SdkManager sdkManager = SdkManager.createManager(OterStatics.getAndroidHome(), sdkLogger);
IAndroidTarget[] targets = sdkManager.getTargets();
for (IAndroidTarget target : targets) {
combo.add(target.hashString());
}
}
use of com.android.sdklib.ISdkLog in project otertool by wuntee.
the class AvdWorkshop method isAvdExist.
public static boolean isAvdExist(String avd) throws AndroidLocationException {
ISdkLog sdkLogger = AvdWorkshop.getAvdLogger();
SdkManager sdkManager = SdkManager.createManager(OterStatics.getAndroidHome(), sdkLogger);
AvdManager avdManager = new AvdManager(sdkManager, sdkLogger);
for (AvdInfo i : avdManager.getAllAvds()) {
if (i.getName().equals(avd)) {
return (true);
}
}
return (false);
}
Aggregations