use of com.android.prefs.AndroidLocation.AndroidLocationException in project android by JetBrains.
the class KeystoreUtils method getOrCreateDefaultDebugKeystore.
public static File getOrCreateDefaultDebugKeystore() throws Exception {
try {
File debugLocation = new File(KeystoreHelper.defaultDebugKeystoreLocation());
if (!debugLocation.exists()) {
File keystoreDirectory = new File(AndroidLocation.getFolder());
if (!keystoreDirectory.canWrite()) {
throw new AndroidLocationException("Could not create debug keystore because \"" + keystoreDirectory + "\" is not writable");
}
ILogger logger = new StdLogger(StdLogger.Level.ERROR);
// Default values taken from http://developer.android.com/tools/publishing/app-signing.html
// Keystore name: "debug.keystore"
// Keystore password: "android"
// Keystore alias: "androiddebugkey"
// Key password: "android"
KeystoreHelper.createDebugStore(null, debugLocation, "android", "android", "AndroidDebugKey", logger);
}
if (!debugLocation.exists()) {
throw new AndroidLocationException("Could not create debug keystore");
}
return debugLocation;
} catch (AndroidLocationException exception) {
throw new Exception("Failed to get debug keystore path", exception);
}
}
use of com.android.prefs.AndroidLocation.AndroidLocationException in project otertool by wuntee.
the class CreateAvdDialog method createContents.
/**
* Create contents of the dialog.
*/
private void createContents() {
shell = new Shell(getParent(), getStyle());
shell.setSize(335, 236);
shell.setText(getText());
GridLayout gl_shell = new GridLayout(1, false);
gl_shell.marginRight = 5;
gl_shell.marginLeft = 5;
gl_shell.marginTop = 5;
gl_shell.verticalSpacing = 0;
gl_shell.marginWidth = 0;
gl_shell.horizontalSpacing = 0;
gl_shell.marginHeight = 0;
shell.setLayout(gl_shell);
Label lblName = new Label(shell, SWT.NONE);
lblName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
lblName.setText("Name:");
text = new Text(shell, SWT.BORDER);
text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
new Label(shell, SWT.NONE);
Label lblTarget = new Label(shell, SWT.NONE);
lblTarget.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
lblTarget.setText("Target:");
combo = new Combo(shell, SWT.READ_ONLY);
combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
addTargets(combo);
new Label(shell, SWT.NONE);
btnPersistantStorage = new Button(shell, SWT.CHECK);
btnPersistantStorage.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
btnPersistantStorage.setText("Persistant system storage");
btnLaunchAvdAfter = new Button(shell, SWT.CHECK);
btnLaunchAvdAfter.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
btnLaunchAvdAfter.setText("Launch AVD after creation");
new Label(shell, SWT.NONE);
composite = new Composite(shell, SWT.NONE);
GridLayout gl_composite = new GridLayout(2, false);
gl_composite.marginWidth = 0;
gl_composite.marginHeight = 0;
gl_composite.horizontalSpacing = 0;
gl_composite.verticalSpacing = 0;
composite.setLayout(gl_composite);
composite.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, true, 1, 1));
Button btnCreateAvd = new Button(composite, SWT.NONE);
btnCreateAvd.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true, 1, 1));
btnCreateAvd.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
boolean exists = false;
try {
exists = AvdWorkshop.isAvdExist(text.getText());
} catch (AndroidLocationException e) {
logger.error("Problem getting avds: ", e);
}
if (text.getText().trim().equals("") || combo.getText().trim().equals("")) {
GuiWorkshop.messageError(shell, "Please set a name, and select a target.");
} else if (exists) {
GuiWorkshop.messageError(shell, "There is already and AVD with that name, please use a name that does not already exist.");
} else {
result = new CreateAvdBean();
result.setName(text.getText());
result.setPersistant(btnPersistantStorage.getSelection());
;
result.setTarget(combo.getText());
result.setLaunch(btnLaunchAvdAfter.getSelection());
shell.close();
}
}
});
btnCreateAvd.setText("Create AVD");
Button btnCancel = new Button(composite, SWT.NONE);
btnCancel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, true, 1, 1));
btnCancel.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
shell.close();
}
});
btnCancel.setText("Cancel");
}
Aggregations