Display the AVD manager wizard during launches where no compatible AVDs exist.
This commit is contained in:
@@ -1,4 +1,11 @@
|
|||||||
0.9.0 (work in progress)
|
0.9.1:
|
||||||
|
- Added an AVD creation wizard to ADT. It is automatically displayed during a launch if no compatible AVDs are found.
|
||||||
|
- Fixed issue with libs/ folder where files with no extension would prevent the build from finishing.
|
||||||
|
- Improved error handling during the final steps of the build to mark the project if an unexpected error prevent the build from finishing.
|
||||||
|
- Fixed issue when launching ADT on a clean install would trigger org.eclipse.swt.SWTError: Not implemented [multiple displays].
|
||||||
|
|
||||||
|
|
||||||
|
0.9.0:
|
||||||
- Projects now store generated Java files (R.java/Manifest.java and output from aidl) in a 'gen' source folder.
|
- Projects now store generated Java files (R.java/Manifest.java and output from aidl) in a 'gen' source folder.
|
||||||
- Support for the new Android SDK with support for multiple versions of the Android platform and for vendor supplied add-ons.
|
- Support for the new Android SDK with support for multiple versions of the Android platform and for vendor supplied add-ons.
|
||||||
* New Project Wizard lets you choose which platform/add-on to target.
|
* New Project Wizard lets you choose which platform/add-on to target.
|
||||||
|
|||||||
@@ -1,114 +0,0 @@
|
|||||||
Compiling and deploying the Android Development Toolkit (ADT) feature.
|
|
||||||
|
|
||||||
The ADT feature is composed of four plugins:
|
|
||||||
- com.android.ide.eclipse.adt:
|
|
||||||
The ADT plugin, which provides support for compiling and debugging android
|
|
||||||
applications.
|
|
||||||
- com.android.ide.eclipse.common:
|
|
||||||
A common plugin providing utility services to the other plugins.
|
|
||||||
- com.android.ide.eclipse.editors:
|
|
||||||
A plugin providing optional XML editors.
|
|
||||||
- com.android.ide.eclipse.ddms:
|
|
||||||
A plugin version of the tool DDMS
|
|
||||||
|
|
||||||
Because the DDMS plugin source code is not yet released, compiling the
|
|
||||||
ADT/Common/Editors plugins requires to install the DDMS plugin in eclipse.
|
|
||||||
|
|
||||||
Basic requirements:
|
|
||||||
- Eclipse 3.3 or 3.4 with JDT and PDE.
|
|
||||||
- DDMS plugin installed and running.
|
|
||||||
|
|
||||||
|
|
||||||
--------------------------
|
|
||||||
1- Install the DDMS plugin
|
|
||||||
--------------------------
|
|
||||||
|
|
||||||
The easiest way to setup the DDMS plugin in your Eclipse environment is to
|
|
||||||
install the ADT features (see SDK documentation for details) and then remove
|
|
||||||
the following features and plugins:
|
|
||||||
|
|
||||||
- <eclipse-directory>/features/com.android.ide.eclipse.adt_x.x.x.jar
|
|
||||||
- <eclipse-directory>/plugins/com.android.ide.eclipse.adt_x.x.x.jar
|
|
||||||
- <eclipse-directory>/plugins/com.android.ide.eclipse.common_x.x.x.jar
|
|
||||||
- <eclipse-directory>/plugins/com.android.ide.eclipse.editors_x.x.x.jar
|
|
||||||
|
|
||||||
This will leave you with only the DDMS plugin installed in your Eclipse
|
|
||||||
distribution.
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------
|
|
||||||
2- Setting up the ADT/Common project
|
|
||||||
-------------------------------------
|
|
||||||
|
|
||||||
- Download the ADT/Common/Editors source.
|
|
||||||
|
|
||||||
- From the SDK, copy the following jars:
|
|
||||||
* androidprefs.jar => com.android.ide.eclipse.adt folder.
|
|
||||||
* jarutils.jar => com.android.ide.eclipse.adt folder.
|
|
||||||
* ping.jar => com.android.ide.eclipse.common folder.
|
|
||||||
* androidprefs.jar => com.android.ide.eclipse.common folder.
|
|
||||||
|
|
||||||
- Create a java project from existing source for both the ADT plugin and the
|
|
||||||
common plugin.
|
|
||||||
|
|
||||||
- In the Package Explorer, right click the projects and choose
|
|
||||||
PDE Tools > Convert Projects to Plug-in Project...
|
|
||||||
|
|
||||||
- Select your projects in the dialog box and click OK.
|
|
||||||
|
|
||||||
- In the Package Explorer, for ADT and common, right click the jar files mentioned above
|
|
||||||
and choose Build Path > Add to Build Path
|
|
||||||
|
|
||||||
At this point the projects will compile.
|
|
||||||
|
|
||||||
To launch the projects, open the Run/Debug Dialog and create an "Eclipse
|
|
||||||
Application" launch configuration.
|
|
||||||
|
|
||||||
Additionnaly, another feature containing the Android Editors Plugin
|
|
||||||
(com.android.ide.eclipse.editors) is available.
|
|
||||||
|
|
||||||
- Make sure the common project is present in your workspace as the Editors
|
|
||||||
plugin depends on this plugin. Alternatively, you can have the offical ADT
|
|
||||||
feature installed in your Eclipse distribution.
|
|
||||||
- Create a java project from existing source for the Editors project.
|
|
||||||
- In the Package Explorer, right click the project and choose
|
|
||||||
PDE Tools > Convert Projects to Plug-in Project...
|
|
||||||
- Select your project in the dialog box and click OK.
|
|
||||||
|
|
||||||
Create an "Eclipse Application" launch configuration to test the plugin.
|
|
||||||
|
|
||||||
-------------------------------------
|
|
||||||
3- Setting up the Editors project
|
|
||||||
-------------------------------------
|
|
||||||
|
|
||||||
The "editors" plugin is optional. You can use ADT to develop Android
|
|
||||||
applications without the XML editor support. When this plugin is present, it
|
|
||||||
offers several customized form-based XML editors and one graphical layout
|
|
||||||
editor.
|
|
||||||
|
|
||||||
At the time of this release (Android 0.9 SDK), some of the supporting libraries
|
|
||||||
still need some cleanup and are currently only provided as JAR files.
|
|
||||||
|
|
||||||
- Download the ADT/Common/Editors source.
|
|
||||||
|
|
||||||
- From the source archives, copy the following jars:
|
|
||||||
* ninepatch.jar => com.android.ide.eclipse.editors folder.
|
|
||||||
* layoutlib_utils.jar => com.android.ide.eclipse.editors folder.
|
|
||||||
* layoutlib_api.jar => com.android.ide.eclipse.editors folder.
|
|
||||||
|
|
||||||
- From http://kxml.sourceforge.net/ download:
|
|
||||||
* kXML2-2.3.0.jar => com.android.ide.eclipse.editors folder.
|
|
||||||
|
|
||||||
- Create a java project from existing source for both the editors plugin.
|
|
||||||
|
|
||||||
- In the Package Explorer, right click the project and choose
|
|
||||||
PDE Tools > Convert Projects to Plug-in Project...
|
|
||||||
|
|
||||||
- Select your project in the dialog box and click OK.
|
|
||||||
|
|
||||||
- In the Package Explorer for editors, right click the jar files mentioned
|
|
||||||
above and choose Build Path > Add to Build Path
|
|
||||||
|
|
||||||
To launch the projects, reuse the "Eclipse Application" launch configuration
|
|
||||||
created for ADT.
|
|
||||||
|
|
||||||
@@ -35,6 +35,7 @@ import com.android.ide.eclipse.adt.launch.DeviceChooserDialog.DeviceChooserRespo
|
|||||||
import com.android.ide.eclipse.adt.project.ApkInstallManager;
|
import com.android.ide.eclipse.adt.project.ApkInstallManager;
|
||||||
import com.android.ide.eclipse.adt.project.ProjectHelper;
|
import com.android.ide.eclipse.adt.project.ProjectHelper;
|
||||||
import com.android.ide.eclipse.adt.sdk.Sdk;
|
import com.android.ide.eclipse.adt.sdk.Sdk;
|
||||||
|
import com.android.ide.eclipse.adt.wizards.actions.AvdManagerAction;
|
||||||
import com.android.ide.eclipse.common.project.AndroidManifestParser;
|
import com.android.ide.eclipse.common.project.AndroidManifestParser;
|
||||||
import com.android.ide.eclipse.common.project.BaseProjectHelper;
|
import com.android.ide.eclipse.common.project.BaseProjectHelper;
|
||||||
import com.android.prefs.AndroidLocation.AndroidLocationException;
|
import com.android.prefs.AndroidLocation.AndroidLocationException;
|
||||||
@@ -64,6 +65,9 @@ import org.eclipse.jdt.launching.JavaRuntime;
|
|||||||
import org.eclipse.jface.dialogs.Dialog;
|
import org.eclipse.jface.dialogs.Dialog;
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
|
import org.eclipse.jface.window.Window;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -465,17 +469,7 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
|
|||||||
|
|
||||||
// we are going to take the closest AVD. ie a compatible AVD that has the API level
|
// we are going to take the closest AVD. ie a compatible AVD that has the API level
|
||||||
// closest to the project target.
|
// closest to the project target.
|
||||||
AvdInfo[] avds = avdManager.getValidAvds();
|
AvdInfo defaultAvd = findMatchingAvd(avdManager, projectTarget);
|
||||||
AvdInfo defaultAvd = null;
|
|
||||||
for (AvdInfo avd : avds) {
|
|
||||||
if (projectTarget.isCompatibleBaseFor(avd.getTarget())) {
|
|
||||||
if (defaultAvd == null ||
|
|
||||||
avd.getTarget().getApiVersionNumber() <
|
|
||||||
defaultAvd.getTarget().getApiVersionNumber()) {
|
|
||||||
defaultAvd = avd;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (defaultAvd != null) {
|
if (defaultAvd != null) {
|
||||||
response.setAvdToLaunch(defaultAvd);
|
response.setAvdToLaunch(defaultAvd);
|
||||||
@@ -487,13 +481,48 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
|
|||||||
continueLaunch(response, project, launch, launchInfo, config);
|
continueLaunch(response, project, launch, launchInfo, config);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// FIXME: ask the user if he wants to create a AVD.
|
AdtPlugin.printToConsole(project, String.format(
|
||||||
// we found no compatible AVD.
|
"Failed to find an AVD compatible with target '%1$s'.",
|
||||||
AdtPlugin.printErrorToConsole(project, String.format(
|
|
||||||
"Failed to find an AVD compatible with target '%1$s'. Launch aborted.",
|
|
||||||
projectTarget.getName()));
|
projectTarget.getName()));
|
||||||
stopLaunch(launchInfo);
|
|
||||||
return;
|
final Display display = AdtPlugin.getDisplay();
|
||||||
|
final int[] result = new int[] { Window.CANCEL };
|
||||||
|
// ask the user to create a new one.
|
||||||
|
display.syncExec(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
Shell shell = display.getActiveShell();
|
||||||
|
if (MessageDialog.openQuestion(shell, "AVD Error",
|
||||||
|
"No Compatible targets were found. Do you wish to create one?")) {
|
||||||
|
AvdManagerAction action = new AvdManagerAction();
|
||||||
|
action.run(null /*action*/);
|
||||||
|
result[0] = action.getDialogResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (result[0] == Window.CANCEL) {
|
||||||
|
AdtPlugin.printErrorToConsole(project, String.format("Launch aborted."));
|
||||||
|
stopLaunch(launchInfo);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
// attempt to reload the AVDs and find one compatible.
|
||||||
|
defaultAvd = findMatchingAvd(avdManager, projectTarget);
|
||||||
|
|
||||||
|
if (defaultAvd == null) {
|
||||||
|
AdtPlugin.printErrorToConsole(project, String.format(
|
||||||
|
"Still no compatible AVDs with target '%1$s': Aborting launch.",
|
||||||
|
projectTarget.getName()));
|
||||||
|
stopLaunch(launchInfo);
|
||||||
|
} else {
|
||||||
|
response.setAvdToLaunch(defaultAvd);
|
||||||
|
|
||||||
|
AdtPlugin.printToConsole(project, String.format(
|
||||||
|
"Launching new emulator with compatible AVD '%1$s'",
|
||||||
|
defaultAvd.getName()));
|
||||||
|
|
||||||
|
continueLaunch(response, project, launch, launchInfo, config);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (hasDevice == false && compatibleRunningAvds.size() == 1) {
|
} else if (hasDevice == false && compatibleRunningAvds.size() == 1) {
|
||||||
Entry<IDevice, AvdInfo> e = compatibleRunningAvds.entrySet().iterator().next();
|
Entry<IDevice, AvdInfo> e = compatibleRunningAvds.entrySet().iterator().next();
|
||||||
@@ -557,6 +586,26 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param avdManager
|
||||||
|
* @param projectTarget
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private AvdInfo findMatchingAvd(AvdManager avdManager, final IAndroidTarget projectTarget) {
|
||||||
|
AvdInfo[] avds = avdManager.getValidAvds();
|
||||||
|
AvdInfo defaultAvd = null;
|
||||||
|
for (AvdInfo avd : avds) {
|
||||||
|
if (projectTarget.isCompatibleBaseFor(avd.getTarget())) {
|
||||||
|
if (defaultAvd == null ||
|
||||||
|
avd.getTarget().getApiVersionNumber() <
|
||||||
|
defaultAvd.getTarget().getApiVersionNumber()) {
|
||||||
|
defaultAvd = avd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return defaultAvd;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Continues the launch based on the DeviceChooser response.
|
* Continues the launch based on the DeviceChooser response.
|
||||||
|
|||||||
@@ -144,8 +144,6 @@ class AvdManagerListPage extends WizardPage {
|
|||||||
* Creates the AVD selector and refresh & delete buttons.
|
* Creates the AVD selector and refresh & delete buttons.
|
||||||
*/
|
*/
|
||||||
private void createAvdGroup(Composite parent) {
|
private void createAvdGroup(Composite parent) {
|
||||||
int col = 0;
|
|
||||||
|
|
||||||
final Composite grid2 = new Composite(parent, SWT.NONE);
|
final Composite grid2 = new Composite(parent, SWT.NONE);
|
||||||
grid2.setLayout(new GridLayout(2, false /*makeColumnsEqualWidth*/));
|
grid2.setLayout(new GridLayout(2, false /*makeColumnsEqualWidth*/));
|
||||||
grid2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
grid2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
HOW TO PACKAGE THE SOURCE OF THE PLUGINS FOR RELEASE.
|
|
||||||
|
|
||||||
Note: this is only useful before we move to the public source repository, after which this will
|
|
||||||
be obsolete.
|
|
||||||
|
|
||||||
The source archive must contains:
|
|
||||||
1/ Source of the EPL plugins that are released.
|
|
||||||
2/ Any closed source dependencies that were created by Google.
|
|
||||||
3/ The readme file explaining how to build the plugins.
|
|
||||||
|
|
||||||
|
|
||||||
1/ PLUGIN SOURCE
|
|
||||||
|
|
||||||
The Plugins that are currently released and that are EPL are:
|
|
||||||
- Android Developer Tools => com.android.ide.eclipse.adt
|
|
||||||
- Common => com.android.ide.eclipse.common
|
|
||||||
- Android Editors => com.android.ide.eclipse.editors
|
|
||||||
|
|
||||||
All three plugins are located in
|
|
||||||
device/tools/eclipse/plugins/
|
|
||||||
|
|
||||||
Before packing them up, it is important to:
|
|
||||||
- remove the bin directory if it exists
|
|
||||||
- remove any symlinks to jar files from the top level folder of each plugin
|
|
||||||
|
|
||||||
2/ PLUGIN DEPENDENCIES
|
|
||||||
|
|
||||||
The plugin dependencies are jar files embedded in some of the plugins. Some of those jar files
|
|
||||||
are android libraries for which the source code is not yet being released (They will be released
|
|
||||||
under the APL).
|
|
||||||
|
|
||||||
Those libraries are not part of the SDK, and need to be taken from a engineering build.
|
|
||||||
They will be located in
|
|
||||||
device/out/host/<platform>/framework/
|
|
||||||
|
|
||||||
The libraries to copy are:
|
|
||||||
- layoutlib_api.jar
|
|
||||||
- layoutlib_utils.jar
|
|
||||||
- ninepatch.jar
|
|
||||||
|
|
||||||
They should be placed in a "libs" folder in the source archive.
|
|
||||||
|
|
||||||
3/ README
|
|
||||||
|
|
||||||
In the source archive, at the top level, needs to be present a file explaining how to compile
|
|
||||||
the plugins.
|
|
||||||
|
|
||||||
This file is located at:
|
|
||||||
device/tools/eclipse/plugins/README.txt
|
|
||||||
Reference in New Issue
Block a user