.class file opens instead of .java while debugging

前端 未结 9 605
北恋
北恋 2020-12-29 03:14

Current setup:

  • MainProject which is a Library Project

  • BranchProject which is a new projects and has MainPr

相关标签:
9条回答
  • 2020-12-29 03:47

    If you tried all above hints and it still doesn't work try this solution, it worked form me:

    1. Right-click on the Project in the Package-Explorer, click Build Path -> Configure Build Path...
    2. Select tab Order and Export
    3. select library that you can't reach code and then click on button Bottom
    4. Then click on Apply and Close

    hope this can help you

    0 讨论(0)
  • I think this depends on, how you set up the dependency in eclipse. You should set up your BranchProject to depend on the source-Files of your MainProject. If you depend on compiles Class-Files is obvious that the debugger opens the class files, because it does not know about the source files.

    0 讨论(0)
  • 2020-12-29 03:50
    1. Open main project properties -> Java Build Path -> Projects tab and add there projects the main project depend on.
    2. Switch to Order and Export tab and uncheck Android Dependencies
    3. Enjoy
    0 讨论(0)
  • 2020-12-29 03:55

    I found a good solution for me here:

    Using Android library in eclipse and jumping to class files instead of source file that is within eclipse workspace

    Simply, select each library project your project depends on, and use Top or Up to move it above the projects outputs. Eg. move all library projects to the top.

    0 讨论(0)
  • When you're using a Library project one of the things you're in fact doing is compiling your Library project into a jar and then referencing that jar in your calling Project.

    If you right click the Project, and select "Configure Build Path" you'll see a tab called "Libraries", if you look inside "Android Dependencies" you'll notice a list of jar's corresponding to your Library projects.

    These jars are expandable, showing you that they have a slot for a source attachment. Usually this would be editable allowing you to directly link the source but in terms of ADT these are already filled and are uneditable.

    When debugging these files you're linked to a read-only class file with this attached source. This is because you're not running against source files directly, you're running against a pre-compiled class file. Until the ADT team get this functionality in place, you're pretty much forced to jump to the direct source code and rebuild everything.

    EDIT

    See @Steven linked answer :)

    0 讨论(0)
  • 2020-12-29 04:01

    I faced the same issue while debugging the a .java file using Eclipse IDE. As per my understanding this issue comes when we put the xyz.class file of xyz.java file or JAR at the project build path. Delete the .class or JAR file from the project class path and rerun .java file in the debug mode. This time you see a source not found window. Click on "Source not found" button and check "Find duplicates..." at the bottom of the window. Done your problem is solved :)

    0 讨论(0)
提交回复
热议问题