So, I'm still experiencing some trouble deploying to Android, but I figured this was a new issue that warranted a new thread.
I've tried running my program on both my device and on an emulator, and in both cases it now crashes silently. To investigate, I started debugging in the emulator, and the program again crashed on startup, throwing an IllegalArgumentException in the function eglCreateContext().
According to the documentation (here: http://java.sun.com/javame/reference/apis/jsr239/javax/microedition/khronos/egl/EGL10.html#eglCreateContext(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig, javax.microedition.khronos.egl.EGLContext, int)
) the exception is thrown if any of the arguments are null; in this case, my config argument is null.
Has anyone had this issue before, and is there any indication of where it can be fixed?
- Changed the .ini file in the assets/ directory to be my own config file.
- In Android.mk, I listed all of my .cpp files, and added LOCAL_CPPFLAGS to indicate my own include directory (-I/my/directory). I also changed LOCAL_MODULE to be my own app's library.
- In Application.mk, I added "APP_STL := stlport_static", since my game makes use of the STL libraries (for convenience's sake).
- In AndroidManifest.xml, I made the appropriate changes to the package and app names.
- I substituted my own Game.java file for OrxDemo.java (though they are identical except for the loadLibrary() call to load my own .so file).
After all that, if I export the OrxTest project to a signed .apk, it works on my device. If I do the same with my own game, it crashes immediately.
Your modification seems to be correct.
Did you run orx in debug mode or it's a release version ? You have to know that an Assert on android stop the processus. But you have it in the LogCat system.
So, if you use orx in debug , check the log. If you run orx in release, try the debug to have more information. Don't forget to replace orx => orxd in your Android.mk.
But, your apk problem isn't good. I think you should solve that. Did you try to run a demo from the ndk ? Just to see if you have the same problem ?
If I'm running in Debug mode on the device, where is the log stored? Or do you mean I should just debug through USB?
Thanks again for all the help. First time making an Android app here, so it's...unfamiliar territory.
I had all my .ini files in the right place; however, since I'd copied the entire project from OrxTest, I still had orx.ini and orxd.ini lying around. I figured I should delete these and substitute my own MyGame[d].ini files, I'd be okay.
As it turns out, my game was searching for the orx[d].ini files, didn't find them, and crashed.
So, if I just put orx[d].ini back into my assets/ folder, and give them the correct links to my other config files, everything works! (Out of curiosity---even though it's not critical at this point---is this true for all Android games, that they need files specifically called orx[d].ini? Or can I specify somewhere that I'm using MyGame[d].ini instead?)
So, LogCat is very very usefull ! And you can add your log in the tool, you just have to call the orxDEBUG_PRINT() or something like that in your code.
For orx[d].ini, actually it's necessary. I forgot to mention that.
Initially, in the first version of this port, Lydesik do something to pass the "main.ini" name to orx using the AndroitManifest.xml. It was working. But know, Lydesik rewrote the android port, using the nvidia framework, and he didn't restore this.
It's just a "time problem". It's not difficult to restore that. Perhaps, I will do that soon, don't know. So actually, the loaded main ini file is always orx.ini (just add an empty orx.ini that include your main.ini file for example?).
Can you wrote somewhere a summary with all your problems (when solved) ? So later, we can complete/modify the wiki ?