使用java源代码调试Android库项目

时间:2021-11-12 10:38:56

I followed the following tutorial http://developer.android.com/guide/developing/projects/projects-eclipse.html

我按照以下教程http://developer.android.com/guide/developing/projects/projects-eclipse.html

and I have 2 projects : the starter project and the library project. Most of the source code is located into the library project

我有2个项目:入门项目和图书馆项目。大多数源代码都位于库项目中

When I debug the android application and when I place a breakpoint into the java, the breakpoint work but it jump in the class file located in Library project folder (of the starter project).

当我调试android应用程序时,当我在java中放置断点时,断点工作,但它跳转到位于Library项目文件夹(初始项目)的类文件中。

I would like to stop in the java code, so I don't have to switch between the source and the compiled code and so modify the source. Is it possible ?

我想停止在java代码中,所以我不必在源代码和编译代码之间切换,因此修改源代码。可能吗 ?

regards

2 个解决方案

#1


68  

Here is what worked for me: (After having clicked debug at least once before)

这对我有用:(之前至少点击一次调试之后)

  • Open the debug view in eclipse (use the menu at the top: Window -> Show View -> Debug)
  • 在eclipse中打开调试视图(使用顶部的菜单:Window - > Show View - > Debug)

  • Right click one of the activities in the debug window "Edit source lookup"
  • 右键单击调试窗口“编辑源查找”中的一个活动

  • Click "Add"
  • Select "Java Project"
  • 选择“Java Project”

  • Check the box for the Android Library project
  • 选中Android Library项目的复选框

  • Press OK

#2


5  

In my case, the solution was:

就我而言,解决方案是:

  • Open the debug view in eclipse (use the menu at the top: Window -> Show View -> Debug)
  • 在eclipse中打开调试视图(使用顶部的菜单:Window - > Show View - > Debug)

  • Right click one of the activities in the debug window "Edit source lookup"
  • 右键单击调试窗口“编辑源查找”中的一个活动

  • Check the "Search for duplicate source files on the path"
  • 检查“在路径上搜索重复的源文件”

jhnclvr's aswer lead me to this dialog

jhnclvr的aswer引导我进入这个对话框

#1


68  

Here is what worked for me: (After having clicked debug at least once before)

这对我有用:(之前至少点击一次调试之后)

  • Open the debug view in eclipse (use the menu at the top: Window -> Show View -> Debug)
  • 在eclipse中打开调试视图(使用顶部的菜单:Window - > Show View - > Debug)

  • Right click one of the activities in the debug window "Edit source lookup"
  • 右键单击调试窗口“编辑源查找”中的一个活动

  • Click "Add"
  • Select "Java Project"
  • 选择“Java Project”

  • Check the box for the Android Library project
  • 选中Android Library项目的复选框

  • Press OK

#2


5  

In my case, the solution was:

就我而言,解决方案是:

  • Open the debug view in eclipse (use the menu at the top: Window -> Show View -> Debug)
  • 在eclipse中打开调试视图(使用顶部的菜单:Window - > Show View - > Debug)

  • Right click one of the activities in the debug window "Edit source lookup"
  • 右键单击调试窗口“编辑源查找”中的一个活动

  • Check the "Search for duplicate source files on the path"
  • 检查“在路径上搜索重复的源文件”

jhnclvr's aswer lead me to this dialog

jhnclvr的aswer引导我进入这个对话框