I followed the following tutorial 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
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).
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 ?
regards
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)
Right click one of the activities in the debug window "Edit source lookup"
Click "Add"
Select "Java Project"
Check the box for the Android Library project
Press OK
In my case, the solution was:
Open the debug view in eclipse (use the menu at the top: 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
Related
I have installed Eclipse 2020-12 (4.18.0). And also imported 2 Gradle Java projects.
When I try to debug it, so for that I need to provide Debug configuration as we do in Eclipse.
I clicked on Debug Configuration-> Remote Java Application -> New Configuration->Connect.
But while doing that, there are no projects shown when I click on Browse Button.
How to solve this problem?
Also , when I open any java file , it shows 'J' symbol as shown below. J's outlining is double.
Actually, the project was not able to build itself. And Build Path was not shown under Project Properties. So just go to Project > Properties > Project Facets and tick Java from there.
That's all.
Have you tried to open Package explorer(the thing that shows all the files)?
If not go to
window--> show view --> Package explorer
I was programming a fabric minecraft mod in intellij and when I ran the code it said :
Could not find or load main class net.fabricmc.devlaunchinjector.Main
When I compiled the code and tried it in minecraft it worked, but in intellij i couldn't run it.
I was messing around with the files, to see if I can fix it and I found a solution :
Go to "Run Configuration", press the arrow to see the options and tap "Edit
Configurations"
Go to "Minecraft Client" and press the button next to
"net.fabricmc.devlaunchinjector.Main"
search trough your external libraries and find "net.fabricmc.devlauncherinjector.Main"
(it must be right under net.fabricmc-api...) select it, and after that you should see
the "Edit Configurations" window. Press "OK"
If this doesn't work, right click the file and select "Copy Full Path". Then go to
"Edit Configurations" window and paste it where it says
"net.fabricmc.devlauncherinjector.Main"
If the 2 option doesn't work either, close the project, copy the mod folder, and paste
it somewhere else(eg. Desktop, New Folder). And then open your IDE, go to open project
and select the copied folder. Press the "Build.gradle" file and select open as project
and "Trust" .It should now work. If it doesn't , unfortunately I don't know how to fix
it.
thecoopsyt's answer worked for me.
Go to Gradle tab > Reload All Gradle Projects
Wait a few mins for it to check and update your dependencies.
After this I was able to return to testing my project in Intellij... had to fully compile and test before this fix.
In Intellij gradle if
this doesn't work you can put
downloadAssets runClient into a gradle config and it will start a client and download the net.fabricmc.devlauncherinjector.Main
this allows you to use gradles built in Minecraft Client
I'm a newbie in Android Development. And I have this one tini-tiny problem which I'm not able to fix it. Every time I run configurations, and browse the Project name, the Project selection is empty and I cant click on any on it except the "Cancel" Button. Then I can't really launch my project. How does one fix this?
Right click on your package in the Package Explorer, click Properties, and see if you're using any libraries. Make sure that the "Is Library" box is not ticked on your project.
In my particular case I had a Maven Project Loaded into Eclipse Mars, and when I tried to run a specific main class, the project itself didn't appear in the Project List under:
Configurations -> Java Application -> Project -> Browse...
What I did was just to convert the Project to have Facets... in the Project Properties:
Main Menu -> Project -> Properties -> Project Facets
Once I did it, just selected Java and the version I needed and it started working.
In the Java Perspective choose the Run menu and go to Run Configurations
Select the item in the list titled "Android Application" and press the plus/add button.
On the next page, choose the Browse button and choose the Android App that you'd like to run.
I had the same problem and found I hadn't put the project name in Project textbox, in the first tab.
I am doing remote debugging of a Java application and using the debug view of Eclipse. The basic debugging process is working fine and I can see the method stack traces in debug view at the relevant breakpoints. However, I am not seeing the corresponding source code in the tab below and it is saying:
Source not found
The source files are already in my Eclipse project and I can see them in the Java view. I have edited the source look up paths and added the *.java files to it. But even then I am not seeing the source code in the debug view where the execution halts. Any clues on this would be appreciated.
For the Run/Debug configuration that you have been using to Remote Debug, have you followed these steps :
“Run -> Debug configurations…”
Choose the remote config from the tree on the left
Click on the “Source” tab
Click on the “Add…” button
Follow the wizard (add the Project containing the source which is being debugged).
If so, can you post a snapshot of the Run Configuration ?
What I have usually done with a Remote Debug run configuration is Add Source as Java Projects to the Source tab on the Run/Debug configuration. Thus to add a project called so, I would proceed as follows :
And when choosing the project, select the two checkboxes :
To end up with this finally :
I have done the below steps and it worked for me:
Run > Run Configurations
Java Application > Click on Source Tab
Include the project by selecting the option "File System Directory"
Debugging started showing the source code.
You are probably using JRebel which is automatically recompiling and reloading classes. Unfortunately Eclipse Debugger doesn't work with class realoaded in this way. In order to make sure that Eclipse will work fine with the class after changes you have to restart your web application container.
When I'm debugging my code in Eclipse, I get annoyed when I open up the editor to find out I cant edit it because I'm actually viewing the source of the .class file. How do I get Eclipse to open up the .java file instead of the .class file when in debug mode?
EDIT: When I hit a breakpoint in my code, it brings me to MyFile.class, instead of MyFile.java, so I can see my code but not edit it.
EDIT: I'm guessing it has somethign to do with Android and ADT R18
After I finally found some time and good reason to look into this issue a bit deeper I'll elaborate a bit on Thornbjorn's answer.
As of lately, Google changed the way your Android projects package your external Android libraries. In ADT R17 (I think) it started packaging the external projects source into .jar files and including them directly into your project in the Android Dependencies or /libs folder.
Now, when the debugger hits a breakpoint, it brings up your source code in the .jar, essentially telling you to edit a .class file. The problem is that this file is read-only and so you have to go find your .java source manually. (Pain)
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.
OK, so I hate to be "that guy", given the number of people for whom this worked, but this didn't work at all for me. I mean that the "Edit Source Lookup..." menu item was not in the context menu. I did not miss the instruction to do this in the Debug Perspective (presumably in the Project Explorer in the Debug Perspective). I tried it while the app was running and while the app was suspended. I tried checking the menu for the application's project (presumably what the instructions refer to) and for the library's project. No dice. This is with the latest Eclipse build.
However, I was able to resolve the issue:
Set a breakpoint in either your application or the library you are trying to link source for. You can actually put this anywhere as long as the library you are trying to link source for has a function that will appear on the call stack when the breakpoint is hit.
Start debugging your application.
Navigate your app to hit the breakpoint.
Make sure you are in the Debug perspective.
In the Debug tab (where the call-stack appears), find any function from your library.
Right-click that function. The "Edit Source Lookup..." menu option should be there (close to the bottom).
From here, the instructions are the same as Styler's. Click "Add", select "Java Project" and add your project (or multiple projects).
Before you exit the "Edit Source Lookup..." window, if you are like me, you will see that Eclipse has chosen to add a bunch of stuff to the list that you didn't choose. Some of that stuff (probably under expandable items with names like "Android Private Libraries" may be the jars for the libraries you just added source for. Remove those jars from the list.
Profit!
Open main project properties -> Java Build Path -> Projects tab and add there projects the main project depend on.
Switch to Order and Export tab and uncheck Android Dependencies
Enjoy
For some reason Eclipse does not believe that the class file comes from your Java file. This is frequently a malconfigured buildpath, or a jar-file used instead of the project generating the jar file.
Look in the project manager panel (<->button) to see where Eclipse finds the class file and then figure out why it uses that location instead of your project with the source file.