【背景】
调试Android程序期间,点击某个子页面“校园超市”:
结果没有按照预期的进入设置好的断点:
结果却进入了如下界面:
DexFile.class
Class File Editor
Source not found
如图:
去看调试堆栈信息显示是:
<terminated>xxx[Android Application] <disconnected>DalvikVM[localhost:8600] xxx [Android Application] DalvikVM[localhost:8601] Thread [<1> main] (Class load: SchoolMarketActivity) <VM does not provide monitor information> DexFile.defineClassNative(String, ClassLoader, int) line: not available [native method] DexFile.defineClass(String, ClassLoader, int, List) line: 226 DexFile.loadClassBinaryName(String, ClassLoader, List) line: 219 DexPathList.findClass(String, List) line: 322 PathClassLoader(BaseDexClassLoader).findClass(String) line: 54 PathClassLoader(ClassLoader).loadClass(String, boolean) line: 497 PathClassLoader(ClassLoader).loadClass(String) line: 457 SchoolFragment.onClick(View) line: 138 RelativeLayout(View).performClick() line: 4446 View$PerformClick.run() line: 18480 Handler.handleCallback(Message) line: 733 ViewRootImpl$ViewRootHandler(Handler).dispatchMessage(Message) line: 95 Looper.loop() line: 136 ActivityThread.main(String[]) line: 5314 Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] Method.invoke(Object, Object...) line: 515 ZygoteInit$MethodAndArgsCaller.run() line: 864 ZygoteInit.main(String[]) line: 680 NativeStart.main(String[]) line: not available [native method] Thread [<10> Binder_2] (Running) Thread [<9> Binder_1] (Running) Daemon Thread [<11> [email protected]@43dd4ad8] (Running) Thread [<12> PriorityExecutor #1] (Running) Thread [<13> uil-pool-d-3-thread-1] (Running) Thread [<14> uil-pool-2-thread-1] (Running) Thread [<15> uil-pool-d-3-thread-2] (Running) Thread [<16> uil-pool-2-thread-2] (Running) Thread [<18> WifiManager] (Running) Thread [<19> PriorityExecutor #2] (Running) Thread [<21> PriorityExecutor #3] (Running) Thread [<22> pool-3-thread-1] (Running) Thread [<20> uil-pool-2-thread-3] (Running) Thread [<23> Binder_3] (Running) Daemon Thread [<17> [email protected]@43dabc88] (Running) Thread [<24> FinalHttp #1] (Running)
【解决过程】
1.搜:
android debug DexFile.class Class File Editor Source not found
android debug DexFile.class
参考:
android – Eclipse debugger stops by itself without any throwable – Stack Overflow
和这个比较像。没有任何可抛出的异常,结果自己却停止调试了。
java – DexFile.class error in eclipse – Stack Overflow
Android Eclipse failing to debug – Stack Overflow
先去看看所有的断点:
发现第一个断点,双击后,就跳转到某个类SchoolMarketActivity的初始化部分了:
估计就是此条断点,导致与调试程序的时候,系统无法找到SchoolMarketActivity的内部(的android的系统的)初始化的代码,所以才停止掉的。
2.现在去去掉该断点:
然后再重新调试:
果然正常了:
直接进入,该类的内部的代码中的,第一个断点了:
就没有再显示那个:
DexFile.class Class File Editor Source not found
的事情。
【总结】
当调试android的代码时,出现:
DexFile.class
Class File Editor
Source not found
的时候,是:
由于之前对于某个类,此处是SchoolMarketActivity的定义的第一行,类似于:
public class SchoolMarketActivity extends PullToRefreshActivity {
的地方,加了断点,导致Android在调试期间,尝试去找到对应的类的内部的初始化的代码,
但是找不到,所以才显示上面的Source not found。
解决办法很简单:
把上述的那行的断点去掉。
而想要看到对应的断点,可以通过:
Eclipse->Window->Show View->(Other->Debug->)Breakpoints
即可看到对应的断点。
找到对应的断点,取消选择,即可。
重新调试,就不会再进入那个DexFile.class的Source not found了,就可以进入正常代码的断点中了。
转载请注明:在路上 » 【已解决】Android代码调试没有进入预期的断点却进入DexFile.class Class File Editor Source not found