Project Not Reflecting Changes to Code

Hello, I have recently updated to the current stable version of jME. I tried importing my old projects, but one of them, an Android game project, failed for some reason (jME wouldn’t detect it as a valid project folder, even though it detected others fine), so I copied the source files into the folder for a new project and modified the code as necessary to get it running, in order to avoid having to completely rewrite everything. It worked, and I could get it to run.

Recently I was trying to solve a bug, but to no avail. I then suspected that the game was not updated with the modified code, so I tried turning off touch input as a test. And lo, the game was still receiving touch input. I then tried the following to see if anything would work:

-run as main project
-right clicking the project and running it from there
-cleaning and building the project before running it
-copying and installing the debug-unaligned apk
-uninstalling the game from phone before trying the above
-restarting my computer

Nothing worked, unfortunately. I checked a tutorial project and tried modifying that to see if it reflected changes, and it did, which is why I’m posting in Android to see if the problem is specific to Android and if other users are also experiencing this.

So, what’s happening here? Is it because of the configuration of my project? Did my improper method of copying/importing source files cause this? Will I need to create a new project and start from scratch?

Forgive the double post, I couldn’t find a way to edit my original post. Had a thought and tried searching with better key words, and found this topic:

http://hub.jmonkeyengine.org/forum/topic/rebuilding-does-not-reflect-code-changes/

What I gathered was this was already a known bug, and I can’t use a different main file from the one that was already generated? If so then I will have to create a new project and start from there, but it wouldn’t be a complete loss. I would still like some confirmation though before I move on, and to know if there is anything that can be done.

In my experience, when code edits have no effect on an application, the usual reason is that the app is still running in the development environment.

For instance, when an app is stopped at a breakpoint, or after certain sorts of app crashes, the dev environment believes the executable file is “running” and refuses to overwrite it, even if you rebuild the project. (Why it refuses <span style=“text-decoration:underline;”>silently</span> is a mystery to me.) So when you restart the app, you run the old executable and your changes seem to have had no effect. One clue that this is going on is that the app is shown as “running” in the IDE’s footer line. Not until you finish the debugging session or cancel the process can you effectively rebuild the project.

I can’t tell if this is your issue, but it seems worth mentioning.

Hmm, it could be, in the previous version I had a window which appeared when I was running the project, and it continued running even after disconnecting my phone from the computer. I had to manually stop it before I could continue with editing the project, because otherwise there would be multiple processes of the same project, even though the previous process is no longer used.

It might not be that, since the problem stays even after restarting my computer (assuming all running processes are terminated when the IDE is closed), but it’s worth a shot. Would you have any idea what that window could be? If I remember correctly it also outputted system.out.println() stuff, but it wasn’t the logger window. It usually has “Android” as it’s tab name I think, and appeared whenever I tried running the project.

@erien said: Would you have any idea what that window could be?

Sorry, I don’t.

So, after recreating my project, modifying existing pre-generated files and generating new files via the SDK itself instead of copying the files directly, I managed to get my project to run again. I am unsure if it is reflecting changes, as for some reason it is stuck on launch and won’t respond when I press the back button, even though my phone vibrates, thus meaning that it is receiving input. The bottom left text showing the frame rate is stuck at 0 fps too. I will need to revert to a previous version of my program and see if it’s stuck due to something from the Main file, or the MainActivity file.

Is there somewhere where I can see what changes occurred during the upgrade from jME3 RC2 to jME3 stable? Specifically Android related changes, because it feels like there were a lot of changes that will require my code to be modified in order to work in the current version.

A specific question I have is how to refer to the Main.java file. In the past one would import it into MainActivity, create a “Main main” variable for it, and used that for stuff (such as checking if main == null). How would that operation work now? Could I just do packagename.Main to do it?

P.S A mistake I made was creating an “Android” project directly instead of creating a jME project and following the tutorial for Android distribution. I had assumed they were the same, but found out that an Android project was for a from the ground up type of development. Just a reminder in case anybody else stumbles into this.

Your anecdotal explanations are not very useful for helping you. Best follow the manual on android deployment, explain what you do differently if anything (and why) and then post the exact code and error messages you get. Telling us what you think you do doesn’t help at all.

First, I’d like to clarify that the original question for this thread has been solved, and that the program now reflects changes made properly. This was done by:
-creating a new jME project
-copying code into generated files and generating new files via the sdk itself

With regards to the second question about referring to the Main.java file from the MainActivity, I was getting an error from the following code snippet:

[java]
// wait for app to be up before firing in sensors
if (main==null){
main=(Main) getJmeApplication(); //this gave a “getJmeApplication() not found” error
return;
}
[/java]

After testing and checking however… This is embarassing, but apparently I was modifying the wrong activity file. The file I was editing was for a different project which I had previously deleted. When I modified the correct file, everything worked perfectly, and no errors popped up.

So it would be safe to say that my problem has been solved, and this thread can be closed. Thanks for all the answers and comments that helped me towards solving the problems I had, and I am very sorry for the bother over the amateurish mistakes.

This stuff is complex. Don’t feel bad about asking for help.