我的Eclipse Android应用程序是在android-sdk \ platforms \ android-16中使用android.jar构建的,在断点处我想查看下面的代码调用堆栈:Android-16的源代码与jar文件不匹配
ViewRoot.draw(boolean) line: 1522
我有android-sdk \ sources \ android-16中的android-16的源代码。然而,没有ViewRoot.java - 我最近的是android-sdk \ sources \ android-16 \ android \ view中的ViewRootImpl.java。 draw(boolean)函数在那里,但是从2050行开始。 1522行的功能完全不同。
所以我的问题是:为什么文件名和行号不匹配?
我的清单有targetSdkVersion =“15”,但这不应该有任何区别,当然?我已经在sources文件夹中搜索了ViewRoot.java,但只能找到ViewRootImpl.java和ViewRootImpl_Delegate.java(不管是什么)。
编辑: 添加完整的调用堆栈
Spine [Android Application]
DalvikVM[localhost:8613]
Thread [<1> main] (Suspended (breakpoint at line 670 in ChartView))
<VM does not provide monitor information>
ChartView.onDraw(Canvas) line: 670
ChartView(View).draw(Canvas) line: 6880
NineFrameLayout(ViewGroup).drawChild(Canvas, View, long) line: 1646
NineFrameLayout(ViewGroup).dispatchDraw(Canvas) line: 1373
LinearLayout(ViewGroup).drawChild(Canvas, View, long) line: 1644
LinearLayout(ViewGroup).dispatchDraw(Canvas) line: 1373
FrameLayout(ViewGroup).drawChild(Canvas, View, long) line: 1644
FrameLayout(ViewGroup).dispatchDraw(Canvas) line: 1373
PhoneWindow$DecorView(ViewGroup).drawChild(Canvas, View, long) line: 1644
PhoneWindow$DecorView(ViewGroup).dispatchDraw(Canvas) line: 1373
PhoneWindow$DecorView(View).draw(Canvas) line: 6883
PhoneWindow$DecorView(FrameLayout).draw(Canvas) line: 357
PhoneWindow$DecorView.draw(Canvas) line: 1862
ViewRoot.draw(boolean) line: 1522
ViewRoot.performTraversals() line: 1258
ViewRoot.handleMessage(Message) line: 1859
ViewRoot(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 3683
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 507
ZygoteInit$MethodAndArgsCaller.run() line: 839
ZygoteInit.main(String[]) line: 597
NativeStart.main(String[]) line: not available [native method]
Thread [<8> Binder Thread #2] (Running)
Thread [<7> Binder Thread #1] (Running)
Thread [<10> Binder Thread #3] (Running)
Thread [<11> Binder Thread #4] (Running)
这是发生了什么事情在ViewRoot.draw,我很感兴趣,因为这是在调用堆栈中的点(使用调试器分步回),其中查看屏幕在运行姜饼的电话上消失(在我的情况下是AVD--我没有那个硬件)。这是因为我升级了UI以使用SherlockActionBar,但所涉及的代码是从Android导入的 - 而不是Sherlock库。但我的问题仍然存在 - 为什么我不能在android-16源代码中找到ViewRoot.java,只有一个与行号不匹配的类似模块?
请考虑发布整个堆栈跟踪。 – CommonsWare
@CommonsWare我假设你指的是调用堆栈。没有堆栈跟踪,我把它与崩溃联系起来,或者这只是语义。如果它有助于回答我的问题,我会很快发布它(一旦我运行了它)。 –
从我理解你得到的代码行将相对于Android版本的apk运行,而不是它被编译的版本。特别是如果你认为它用来编译的android.jar只有方法存根,试着看看你正在运行的模拟器的设备版本,看看代码是否匹配。 –