无法在Android SDK源(Eclipse)的某些位置设置断点

时间:2023-01-18 09:04:06

I can't put breakpoints in private or package access methods of the Android SDK, or classes. I can put them in public or protected. Why? And if possible, how do I change that?

我不能将断点放在Android SDK或类的私有或包访问方法中。我可以将它们公之于众或受到保护。为什么?如果可能的话,我该如何改变呢?

More exactly, the not working case is that a breakpoint is added to the class signature and it says "class: classname". But the debugger never stops in this class.

更确切地说,不工作的情况是断点被添加到类签名中并且它表示“class:classname”。但调试器永远不会停止在这个类中。

It doesn't work in certain classes at all, also not in public methods... for example Gallery class. But it works other class, for example AnalogClock (which is in the same package as Gallery). Or View.

它根本不适用于某些类,也不适用于公共方法......例如Gallery类。但它适用于其他类,例如AnalogClock(与Gallery相同的包)。或查看。

1 个解决方案

#1


0  

one reason that you can not set breakpoint is that the Android sdk class do not contains the implements details.

您无法设置断点的一个原因是Android sdk类不包含实现详细信息。

you can use Java Decompiler to open the /(sdk path)/platforms/android-xx/android.jar file to see the sdk class detail, and you will find the implements of all methods are like these:

您可以使用Java Decompiler打开/(sdk路径)/platforms/android-xx/android.jar文件来查看sdk类详细信息,您会发现所有方法的实现都是这样的:

  public int getVerticalScrollbarWidth()
  {
    throw new RuntimeException("Stub!");
  }

and do not contains the private methods. so the eclipse java debugger do not know how to set the breakpoint, because the attach source do not correspond exactly to sdk class.

并且不包含私有方法。所以eclipse java调试器不知道如何设置断点,因为附加源与sdk类并不完全对应。

i have a not so good way to deal with this problem. 1.copy the source file(e.g. /android/view/View.java) to any android/java project in eclipse. 2.set the breakpoint in the file in step 1. 3.now you can hit the breakpoint.

我有一个不太好的方法来处理这个问题。 1.将源文件(例如/android/view/View.java)复制到eclipse中的任何android / java项目。 2.在步骤1中设置文件中的断点.3。现在可以命中断点。

#1


0  

one reason that you can not set breakpoint is that the Android sdk class do not contains the implements details.

您无法设置断点的一个原因是Android sdk类不包含实现详细信息。

you can use Java Decompiler to open the /(sdk path)/platforms/android-xx/android.jar file to see the sdk class detail, and you will find the implements of all methods are like these:

您可以使用Java Decompiler打开/(sdk路径)/platforms/android-xx/android.jar文件来查看sdk类详细信息,您会发现所有方法的实现都是这样的:

  public int getVerticalScrollbarWidth()
  {
    throw new RuntimeException("Stub!");
  }

and do not contains the private methods. so the eclipse java debugger do not know how to set the breakpoint, because the attach source do not correspond exactly to sdk class.

并且不包含私有方法。所以eclipse java调试器不知道如何设置断点,因为附加源与sdk类并不完全对应。

i have a not so good way to deal with this problem. 1.copy the source file(e.g. /android/view/View.java) to any android/java project in eclipse. 2.set the breakpoint in the file in step 1. 3.now you can hit the breakpoint.

我有一个不太好的方法来处理这个问题。 1.将源文件(例如/android/view/View.java)复制到eclipse中的任何android / java项目。 2.在步骤1中设置文件中的断点.3。现在可以命中断点。