Reputation: 14571
Current setup:
MainProject which is a Library Project
BranchProject which is a new projects and has MainProject as a Reference
Whenever I debug and a file from MainProject is on focus (actually BranchProject has only graphic and xml layout changes) the Debug window opens a .class file which is read only. I want it to open the .java file so I can edit it directly.
Upvotes: 33
Views: 61041
Reputation: 1
Most of the time it happens when specific source folder are not added in build path Sources tab.
Right-click on the Project in the Package-Explorer, click Build Path -> Configure Build Path -> Source Tab
Add the source folder if your project source folder is not there. Select Add folder -> select your project source folder specifically. Eg: project_name/src . Then Apply it and restart server.
Upvotes: 0
Reputation: 51
If you tried all above hints and it still doesn't work try this solution, it worked form me:
hope this can help you
Upvotes: 0
Reputation: 1562
The problem is that the class file is preferred over the java (by default), here is how you can change that for Eclipse (tested on NEON 2):
Upvotes: 1
Reputation: 127
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 :)
Upvotes: 1
Reputation: 4667
main project properties -> Java Build Path -> Projects
tab and add there projects the main project depend on.Order and Export
tab and uncheck Android Dependencies
Upvotes: 0
Reputation: 12768
I found a good solution for me here:
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.
Upvotes: 0
Reputation: 25864
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 :)
Upvotes: 6
Reputation: 20102
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.
Upvotes: 0
Reputation: 615
Skyler's answer from this post worked for me: Opening source code from debug view edits .class after Android R18 update
Here is a summary: The fix is to right click the Project name in the debug view, and select "Edit Source Lookup..." from the menu. From there, remove the Default lookup path. After that, manually add the associated projects (not jars) that your project references. This is done by clicking Add, selecting Java Project, then checking the appropriate projects.
Upvotes: 60