Unable to set breakpoints in some places on Android SDK source (Eclipse)

I cannot set breakpoints in private or batch methods for accessing the Android SDK or classes. I can publish or protect them. What for? And if it is possible, how to change it?

More precisely, the non-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.

It does not work in certain classes at all, nor in public methods ... for example, in the Gallery class. But it works in another class, for example AnalogClock (which is in the same package as Gallery). Or View.

+4
source share
1 answer

one of the reasons you cannot set a breakpoint is because the sdk class for Android does not contain component information.

you can use the Java Decompiler to open the / (sdk path) /platforms/android-xx/android.jar file to see the sdk class detail and you will find that the tools of all the methods look like this:

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

and does not contain private methods. therefore, the eclipse java debugger does not know how to set a breakpoint, because the connection source does not exactly match the sdk class.

I have a not-so-good way to handle this problem. 1. copy the source file (e.g. / android / view / View.java) to any android / java project in eclipse. 2. set a breakpoint in the file in step 1. Now you can get to the breakpoint.

0
source

All Articles