When I open a standalone DDMS besides Eclipse, it generates the below error.
hieund@hieund:~$ ddms
01:51:58 E/ddms: Could not open Selected VM debug port (8700). Make sure you do not have another instance of DDMS or of the eclipse plugin running. If it's being used by something else, choose a new port number in the preferences.
(DDMS:6904): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width -5 and height 17
(DDMS:6904): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width -5 and height 17
01:52:18 E/DDMS: device offline
com.android.ddmlib.AdbCommandRejectedException: device offline
at com.android.ddmlib.AdbHelper.setDevice(AdbHelper.java:736)
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:373)
at com.android.ddmlib.Device.executeShellCommand(Device.java:364)
at com.android.ddmuilib.SysinfoPanel.loadFromDevice(SysinfoPanel.java:159)
at com.android.ddmuilib.SysinfoPanel.deviceSelected(SysinfoPanel.java:126)
at com.android.ddmuilib.SelectionDependentPanel.deviceSelected(SelectionDependentPanel.java:52)
at com.android.ddms.UIThread.selectionChanged(UIThread.java:1721)
at com.android.ddmuilib.DevicePanel.notifyListeners(DevicePanel.java:752)
at com.android.ddmuilib.DevicePanel.notifyListeners(DevicePanel.java:740)
at com.android.ddmuilib.DevicePanel.access$1100(DevicePanel.java:56)
at com.android.ddmuilib.DevicePanel$1.widgetSelected(DevicePanel.java:357)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at com.android.ddms.UIThread.runUI(UIThread.java:517)
at com.android.ddms.Main.main(Main.java:116)
01:52:32 E/ddms: shutting down due to uncaught exception
01:52:32 E/ddms: Failed to execute runnable (java.lang.ArrayIndexOutOfBoundsException: -1)
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.ArrayIndexOutOfBoundsException: -1)
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Unknown Source)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at com.android.ddms.UIThread.runUI(UIThread.java:517)
at com.android.ddms.Main.main(Main.java:116)
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
at org.eclipse.jface.viewers.AbstractTableViewer$VirtualManager.resolveElement(AbstractTableViewer.java:100)
at org.eclipse.jface.viewers.AbstractTableViewer$1.handleEvent(AbstractTableViewer.java:70)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Table.checkData(Unknown Source)
at org.eclipse.swt.widgets.Table.cellDataProc(Unknown Source)
at org.eclipse.swt.widgets.Display.cellDataProc(Unknown Source)
at org.eclipse.swt.internal.gtk.OS._gtk_list_store_append(Native Method)
at org.eclipse.swt.internal.gtk.OS.gtk_list_store_append(Unknown Source)
at org.eclipse.swt.widgets.Table.setItemCount(Unknown Source)
at org.eclipse.jface.viewers.TableViewer.doSetItemCount(TableViewer.java:217)
at org.eclipse.jface.viewers.AbstractTableViewer.internalVirtualRefreshAll(AbstractTableViewer.java:661)
at org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:635)
at org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:620)
at org.eclipse.jface.viewers.StructuredViewer$7.run(StructuredViewer.java:1430)
at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1365)
at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1328)
at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1428)
at org.eclipse.jface.viewers.ColumnViewer.refresh(ColumnViewer.java:537)
at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1387)
at com.android.ddmuilib.logcat.LogCatPanel$LogCatTableRefresherTask.run(LogCatPanel.java:1000)
at org.eclipse.swt.widgets.RunnableLock.run(Unknown Source)
... 5 more
I tried to change port for DDMS in Eclipse but it still doesn't work.
Install Eclipse from repository.
If you're running x64:
sudo apt-get install ia32-libs
Install the ADT plugin through the Help install software menu. With this link.
Choose to install the SDKs during the ADT install.
Navigate to your android-sdk/tools folder and run
./ddms
This achieves the results below.
If it is still failing there's this answer from SO
--snip--
It looks like you have two problems:
You are trying to run DDMS twice. You do not need to run the free standing version of DDMS since there is version of it integrated in Eclipse as part of the Android plug-in. If you change to the DDMS perspective in Eclipse, I'm sure you will find that all the same features are available.
You have not told DDMS which VM you want to debug at localhost:8700. Before you attempt to establish your remote debug connection, you must go to the DDMS perspective and click on the system_process (or whatever process you want to debug).
--/snip--