使用NetBeans在Android上等待调试器

时间:2011-01-14 16:58:46

标签: android debugging netbeans hang

当我尝试使用NetBeans和nbandroid插件调试Android应用程序时,它会启动模拟器,最终当模拟器启动时会显示

  

等待调试器
  应用程序[app name]([package name])正在等待调试器附加。

我得到一个强制关闭按钮。

以下是DDMS的日志。

01-14 11:44:46.131: INFO/ActivityManager(85): Force stopping package [packagename] uid=-1
01-14 11:44:46.131: INFO/ActivityManager(85): Starting activity: Intent { flg=0x10000000 cmp=[packagename]/.[activityclassname] }
01-14 11:44:46.311: DEBUG/AndroidRuntime(420): Shutting down VM
01-14 11:44:46.331: DEBUG/jdwp(420): adbd disconnected
01-14 11:44:46.371: INFO/AndroidRuntime(420): NOTE: attach of thread 'Binder Thread #3' failed
01-14 11:44:46.411: INFO/ActivityManager(85): Start proc [packagename] for activity [packagename]/.[activityclassname]: pid=427 uid=10032 gids={3003}
01-14 11:44:47.200: WARN/ActivityThread(427): Application [packagename] is waiting for the debugger on port 8100...
01-14 11:44:47.231: INFO/System.out(427): Sending WAIT chunk
01-14 11:44:50.280: DEBUG/SntpClient(85): request time failed: java.net.SocketException: Address family not supported by protocol
01-14 11:44:56.253: WARN/ActivityManager(85): Launch timeout has expired, giving up wake lock!
01-14 11:44:57.003: WARN/ActivityManager(85): Activity idle timeout for HistoryRecord{43f85578 [packagename]/.[activityclassname]}
01-14 11:45:05.350: DEBUG/dalvikvm(166): GC_EXPLICIT freed 595 objects / 29656 bytes in 120ms
01-14 11:45:10.320: DEBUG/dalvikvm(228): GC_EXPLICIT freed 190 objects / 13056 bytes in 92ms
01-14 11:45:15.331: DEBUG/dalvikvm(304): GC_EXPLICIT freed 277 objects / 13112 bytes in 92ms
01-14 11:45:20.401: DEBUG/dalvikvm(162): GC_EXPLICIT freed 586 objects / 32240 bytes in 109ms
01-14 11:47:05.161: DEBUG/dalvikvm(162): GC_EXPLICIT freed 49 objects / 2704 bytes in 93ms
01-14 11:49:05.201: DEBUG/dalvikvm(162): GC_EXPLICIT freed 15 objects / 600 bytes in 130ms
01-14 11:49:47.595: INFO/jdwp(85): Ignoring second debugger -- accepting and dropping
01-14 11:49:47.710: INFO/jdwp(155): Ignoring second debugger -- accepting and dropping
01-14 11:49:47.740: INFO/jdwp(160): Ignoring second debugger -- accepting and dropping
01-14 11:49:47.750: INFO/jdwp(162): Ignoring second debugger -- accepting and dropping
01-14 11:49:47.772: INFO/jdwp(166): Ignoring second debugger -- accepting and dropping
01-14 11:49:47.810: INFO/jdwp(194): Ignoring second debugger -- accepting and dropping
01-14 11:49:47.820: INFO/jdwp(224): Ignoring second debugger -- accepting and dropping
01-14 11:49:47.861: INFO/jdwp(228): Ignoring second debugger -- accepting and dropping
01-14 11:49:47.872: INFO/jdwp(242): Ignoring second debugger -- accepting and dropping
01-14 11:49:47.880: INFO/jdwp(271): Ignoring second debugger -- accepting and dropping
01-14 11:49:47.980: INFO/jdwp(427): Ignoring second debugger -- accepting and dropping
01-14 11:49:47.980: INFO/jdwp(304): Ignoring second debugger -- accepting and dropping
01-14 11:49:47.980: INFO/jdwp(337): Ignoring second debugger -- accepting and dropping
01-14 11:49:48.020: INFO/jdwp(293): Ignoring second debugger -- accepting and dropping
01-14 11:49:50.290: DEBUG/SntpClient(85): request time failed: java.net.SocketException: Address family not supported by protocol
01-14 11:50:10.970: DEBUG/Email(271): *** synchronizeMailboxGeneric ***
01-14 11:50:11.250: DEBUG/dalvikvm(271): GC_FOR_MALLOC freed 9369 objects / 455104 bytes in 126ms
01-14 11:51:05.171: DEBUG/dalvikvm(162): GC_EXPLICIT freed 15 objects / 600 bytes in 90ms
01-14 11:53:05.180: DEBUG/dalvikvm(162): GC_EXPLICIT freed 15 objects / 600 bytes in 95ms
01-14 11:54:50.293: DEBUG/SntpClient(85): request time failed: java.net.SocketException: Address family not supported by protocol

这是NetBeans ant日志

init:
deps-jar:
Compiling 1 source file to C:\[apppath]\build\classes
compile:
Updating zip: C:\[apppath]\dist\[appname].apk_

THIS TOOL IS DEPRECATED. See --help for more information.

Deleting: C:\[appdir]\dist\[appname].apk_
Deleting: C:\[apppath]\dist\[appname].apk__
Building zip: C:\[apppath].zip
jar:
        pkg: /data/local/tmp/[appname].apk
Success
569 KB/s (275945 bytes in 0.473s)
About to start [packagename]/[packagename].[activityclassname]
Starting: Intent { cmp=[packagenamel]/.[activityclassname] }

NetBeans告诉我进程仍然在运行,如果需要,我会给我一个“kill”的停止按钮。

我的CPU和磁盘也大多闲置。

3 个答案:

答案 0 :(得分:4)

我也遇到了这个问题。您必须在模拟器显示“等待调试器附加”时手动附加调试器。在Netbean的菜单栏中,单击“Debug”,然后单击“Attach Debugger ...”。您必须从“处理”下拉列表中选择您的包,然后单击“附加”。应该这样做。

无论如何,这在Netbeans 7中有效。

答案 1 :(得分:2)

您有两种选择:连接调试器或终止进程。

查看您的logcat,您至少有两个尝试连接到每个应用程序进程的桌面应用程序,这是“忽略第二个调试程序”消息的来源。

如果您使用ADT插件运行Eclipse,并且同时运行独立的DDMS,则会发生这种情况。我不知道你在运行什么或netbeans插件做了什么,但我会先弄清楚你是否有两个不同的东西争夺控制权。

答案 2 :(得分:0)

确保您已在模拟器上为您的应用启用了调试功能。