无法打开 DDMS

无法打开 DDMS

当我打开 Eclipse 之外的独立 DDMS 时,它会生成以下错误。

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

我尝试在 Eclipse 中更改 DDMS 的端口,但仍然不起作用。 在此处输入图片描述

答案1

从存储库安装 Eclipse。
如果您运行的是 x64:sudo apt-get install ia32-libs
通过帮助安装软件菜单安装 ADT 插件。使用链接。
在 ADT 安装期间选择安装 SDK。
导航到您的 android-sdk/tools 文件夹并运行./ddms
这将实现以下结果。 DDMS 与完整 ADT 安装配合使用 在此处输入图片描述

如果仍然失败,还有这个答案来自SO
--剪辑--

看起来你有两个问题:

您正在尝试运行两次 DDMS。您不需要运行独立版本的 DDMS,因为 Eclipse 中已集成了该版本的 Android 插件。如果您在 Eclipse 中切换到 DDMS 视角,我相信您会发现所有相同的功能都可用。

您尚未告诉 DDMS 您想要在 localhost:8700 上调试哪个 VM。在尝试建立远程调试连接之前,您必须转到 DDMS 透视图并单击 system_process(或您想要调试的任何进程)。

--/剪辑--

相关内容