我的应用程序的调试现在突然中断了。它一直很好,我甚至重新加载了我的整个代码的已知良好版本,它仍然无法调试甚至运行。当我点击调试或运行应用程序启动时,即将显示应用程序,它崩溃(甚至进入主视图之前)。我在第一行代码上有一个断点,它甚至都没有达到它。它只是去找不到源 - 源附件不包含文件DexFile.class的源..... 我100%确定我加载的所有代码都正常工作,因为它是上次工作时保存的保存备份。
另外,奇怪的是,如果我此时拔下电缆,应用程序正常加载并正常工作。所以这绝对是一个调试问题。它在开机时被卡住了。我已经重启了我的电脑和电话几次都无济于事。
LogCat:
`04-04 11:17:33.462: DEBUG/AndroidRuntime(4148): CheckJNI is OFF
04-04 11:17:33.462: DEBUG/dalvikvm(4148): creating instr width table
04-04 11:17:33.502: DEBUG/AndroidRuntime(4148): --- registering native functions ---
04-04 11:17:33.712: DEBUG/AndroidRuntime(4148): Shutting down VM
04-04 11:17:33.712: DEBUG/dalvikvm(4148): Debugger has detached; object registry had 1 entries
04-04 11:17:33.712: INFO/AndroidRuntime(4148): NOTE: attach of thread 'Binder Thread #3' failed
04-04 11:17:33.902: DEBUG/AndroidRuntime(4157): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
04-04 11:17:33.902: DEBUG/AndroidRuntime(4157): CheckJNI is OFF
04-04 11:17:33.902: DEBUG/dalvikvm(4157): creating instr width table
04-04 11:17:33.942: DEBUG/AndroidRuntime(4157): --- registering native functions ---
04-04 11:17:34.152: INFO/Process(107): Sending signal. PID: 4137 SIG: 9
04-04 11:17:34.152: INFO/ActivityManager(107): Force stopping package org.scanner uid=10110
04-04 11:17:34.162: ERROR/ActivityManager(107): fail to set top app changed!
04-04 11:17:34.182: INFO/UsageStats(107): Unexpected resume of com.htc.launcher while already resumed in org.scanner
04-04 11:17:34.192: INFO/ActivityManager(107): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=org.obdscanner/.activity.ObdReaderMainActivity }
04-04 11:17:34.202: DEBUG/AndroidRuntime(4157): Shutting down VM
04-04 11:17:34.202: DEBUG/dalvikvm(4157): Debugger has detached; object registry had 1 entries
04-04 11:17:34.212: INFO/AndroidRuntime(4157): NOTE: attach of thread 'Binder Thread #3' failed
04-04 11:17:34.222: WARN/InputManagerService(107): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@464105d8
04-04 11:17:34.242: INFO/ActivityManager(107): Start proc org.scanner for activity org.obdscanner/.activity.ReaderMainActivity: pid=4165 uid=10110 gids={3003, 3002}
04-04 11:17:34.332: WARN/ActivityThread(4165): Application org.scanner is waiting for the debugger on port 8100...
04-04 11:17:34.332: INFO/System.out(4165): Sending WAIT chunk
04-04 11:17:34.352: INFO/dalvikvm(4165): Debugger is active
04-04 11:17:34.472: DEBUG/Norton Community Watch/smrsd(3910): smrsd broadcast intent success!
04-04 11:17:34.512: ERROR/(3910): /data/data/com.symantec.monitor/app_log_item/1301930254.txt//data/data/com.symantec.monitor/app_log_item
04-04 11:17:34.542: INFO/System.out(4165): Debugger has connected
04-04 11:17:34.542: INFO/System.out(4165): waiting for debugger to settle...
04-04 11:17:34.632: INFO/global(3898): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
04-04 11:17:34.742: INFO/System.out(4165): waiting for debugger to settle...
04-04 11:17:34.862: DEBUG/dalvikvm(3898): GC_FOR_MALLOC freed 4492 objects / 274560 bytes in 41ms
04-04 11:17:34.942: INFO/System.out(4165): waiting for debugger to settle...
04-04 11:17:35.142: INFO/System.out(4165): waiting for debugger to settle...
04-04 11:17:35.342: INFO/System.out(4165): waiting for debugger to settle...
04-04 11:17:35.552: INFO/System.out(4165): waiting for debugger to settle...
04-04 11:17:35.752: INFO/System.out(4165): waiting for debugger to settle...
04-04 11:17:35.952: INFO/System.out(4165): waiting for debugger to settle...
04-04 11:17:36.157: INFO/System.out(4165): debugger has settled (1451)
04-04 11:17:37.296: DEBUG/dalvikvm(4165): threadid=1: still suspended after undo (sc=1 dc=1 s=Y)
`
答案 0 :(得分:11)
请参阅正确的答案HERE
您已在其中一个类中设置了断点。只需取消项目中的所有断点并再次运行,它们就没问题了。
Eclipse-&gt; Window-&gt; Show View-&gt;(Other-&gt; Debug-&gt;)断点
答案 1 :(得分:8)
有时,Eclipse和各种Android开发插件会变得不同步。当调试/开发变得“时髦”时,我通常会尝试以下操作
在您的平台上打开终端并使用“platform-tools”目录中的adb
工具。
adb kill-server
adb start-server
如果使用存储库,则存储您的工作副本并还原您的源代码。
答案 2 :(得分:4)
奇怪的解决方案......我刚从包资源管理器中关闭了项目,然后将其从工作区中删除。关闭Eclipse。重新打开Eclipse并导入项目。
(从Jesse的评论中复制并粘贴。)
答案 3 :(得分:2)
我尝试了以上所有内容,但我发现由于eclipse.exe的多个实例而无法正常工作 在任务管理器(CTRL + SHIFT + ESC)中杀死它们就解决了它。
答案 4 :(得分:1)
在您的Android设备(或模拟器)上,转到:
Applications - Settings - Applications - Manage applications - All
您必须选择并卸载它。
然后尝试再次从IDE运行您的应用程序。它现在应该工作。
答案 5 :(得分:0)
创建类型为Remote Java Application
的新调试配置,并将其设置为localhost和您在DDMS窗口中看到的端口。
https://stackoverflow.com/a/13421917/624109
答案 6 :(得分:0)
我知道这有点迟了......如果@ Sam's或@Killesk的答案不起作用,请使用它。
确保清单集android:debuggable
。
在onCreate
中,添加对Debug.waitForDebugger的通话。
将呼叫添加到waitForDebugger
也适用于倒车时。例如,您可以在onCreate
中手动添加以下内容,并让smali / baksmali重新编译它:
invoke-static {}, Landroid/os/Debug;->waitForDebugger()V
我不必经常使用这些技巧,但是当我这样做时,waitForDebugger
始终有效。我不记得有一次我无法使用它来调试调试器。
答案 7 :(得分:0)
由于我的代码被混淆,我发生了这种情况。我没有注意到有人改变了proguard.cfg的生产版本,并注释掉了“-dontobfuscate”行。