Very new to JME3/Android.
I have a very simple app, pretty much the same as JME 3 Tutorial (4) - Hello Update Loop.
It works fine on PC. However, when I run on my phone, it raises the exception:
Class mygame.Main init failed: …
With a HUGE call stack right up through AndroidHarness to davlik.system.NativeStartMenu(-2)
Can anyone explain to a noob what this means?
I should point out it was working before I started modding the tutorial so not a phone setup issue. Its a programmer issue!
My main is actually in: controller.Main. Not in mygame.Main. Where does the mygame nonsense come from in the Android installation?
My Run config says “controller.Main” as my “Main Class”.
does the game work in the dist folder?
On pc yes
The question is which class cannot be found, should be in the line right after the error. On android none of the java.awt packages exist for example.
The android project uses the main class you specify in the jME3 project settings when you create it.
Sorry, still don’t understand.
Where is this MyGame reference coming from? I never asked to call the game MyGame
When I try to edit the text files and change package structure, I am getting into lots of mistakes and errors, which suggest I am doing it the wrong way!
So… Lets get a step back. You create a BasicGame project. The default main class is “mygame.Main”, the projects name is “MyGame” (configurable in project properties). Then you enable the android deployment. With the default settings, a “com.mycompany.mygame.MainActivity” class is created that gets a reference to the “mygame.Main” class so it can wrap and run it on android. The android project is called “MyGame” if you didn’t change your main projects name. After the android project has been created you basically do not need to open any files in it or put any code inside that project.
Only if you want to do android-specific stuff like accessing the camera or similar, you have to do that in the android project and to be able to edit that you need to install NBAndroid. This will also get rid of the wrongly displayed “errors” in the MainActivity.
All of this is also outlined here: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:android
Ah, so I have to make any changes to location of the Main before creating the android project. I was doing it afterwards and this wasn’t being reflected on a clean build.
And to change the Installed app name from ‘MainActivity’ do I edit AndroidManifest.xml by hand?
Yeah, I don’t know why it enters “MainActivity” there, I supply the project name to the project creation tool… :?