E/AndroidRuntime: FATAL EXCEPTION: GLThread 4710
Process: com.example.pursuitandescape, PID: 4573
java.lang.NullPointerException: Attempt to invoke virtual method ‘void com.example.pursuitandescape.PoliceAndThiefGame.stop()’ on a null object reference
at com.example.pursuitandescape.PoliceAndThiefGame.quitGame(PoliceAndThiefGame.java:377)
at com.example.pursuitandescape.PoliceAndThiefGame$touchListener.onTouch(PoliceAndThiefGame.java:240)
at com.jme3.input.InputManager.onTouchEventQueued(InputManager.java:932)
at com.jme3.input.InputManager.processQueue(InputManager.java:863)
at com.jme3.input.InputManager.update(InputManager.java:907)
at com.jme3.app.LegacyApplication.update(LegacyApplication.java:725)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:227)
at com.jme3.app.AndroidHarness.update(AndroidHarness.java:497)
at com.jme3.system.android.OGLESContext.onDrawFrame(OGLESContext.java:336)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1582)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1281)
E/com.jme3.app.AndroidHarness: SEVERE Exception thrown in Thread[GLThread 4710,5,main]
java.lang.NullPointerException: Attempt to invoke virtual method ‘void com.example.pursuitandescape.PoliceAndThiefGame.stop()’ on a null object reference
at com.example.pursuitandescape.PoliceAndThiefGame.quitGame(PoliceAndThiefGame.java:377)
at com.example.pursuitandescape.PoliceAndThiefGame$touchListener.onTouch(PoliceAndThiefGame.java:240)
at com.jme3.input.InputManager.onTouchEventQueued(InputManager.java:932)
at com.jme3.input.InputManager.processQueue(InputManager.java:863)
at com.jme3.input.InputManager.update(InputManager.java:907)
at com.jme3.app.LegacyApplication.update(LegacyApplication.java:725)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:227)
at com.jme3.app.AndroidHarness.update(AndroidHarness.java:497)
at com.jme3.system.android.OGLESContext.onDrawFrame(OGLESContext.java:336)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1582)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1281)
That line of code is trying to call a method on a null object because you never set it to anything. This should have been a problem on desktop also.
We have zero info to help beyond that, though.
Pavl_G’s advice is probably right for Android but it won’t help you work through your misunderstandings about Java coding in this case. That will get pushed to a later time.
You welcome dude , but please donot ignore @pspeed advice too , which should help you along your journey , if you are not well understanding java code , revise java concepts , it’s not a shame to do so , I revise basic IO , streams , Math.util from time to time too while studying android & jme.
@Blake_Ren to reinforce what @pspeed and @Pavl_G have said, programming in general is a constant learning experience. For example, I’m working on my first (real ?) game using this engine, coming from a mostly web and command line background. I’d say I’m familiar with java, but I still always have (more than) a few tabs open for reference. And, if you look at my posts, I’ve been here for help more than enough times haha.
One thing I can suggest (tho everyone codes differently, may work for me but not for others!) is to break your project into sections and complete them section at a time. For example, I’m gonna finish my main menu before I do anything else, then a settings screen, then probably a few basic test scenes that can be loaded from the main menu, and whatever’s past that is too far in the future for me to worry about, I just write it in a note for when I get to it.
In my experience, when your project is broken up into smaller pieces of work, it’s easier (for me atleast) to finish these discreet sections, and if a bug crawls in, I know it’s most likely occuring in that section I’m working on. Just my two pence haha. Good luck in your coding adventure!